myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1045) formatInt does not accept numerical values, which causes JS exception when selecting year from dropdown list.
Date Tue, 31 Jan 2006 11:01:33 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-1045?page=comments#action_12364557 ] 

Martin Marinschek commented on MYFACES-1045:
--------------------------------------------

What do you mean by that comment?

regards,

Martin

> formatInt does not accept numerical values, which causes JS exception when selecting
year from dropdown list.
> -------------------------------------------------------------------------------------------------------------
>
>          Key: MYFACES-1045
>          URL: http://issues.apache.org/jira/browse/MYFACES-1045
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: 1.1.0
>  Environment: Windows XP SP2, IE 6.0, Firefox 1.5
>     Reporter: Stephane Vandenbussche
>  Attachments: popcalendar.js
>
> In file popcalendar.js in the Tomahawk.jar, the function formatint fails to accept numerical
values that are passed by other functions. You can not assume that every value passed to this
function will be a string.
> It is important to fix this in version 1.1.0 because not all projects can upgrade to
version 1.1.1 because of backward compatibilty issues and project history.
> The following implementation makes the function much safer to use with various browsers.
> function formatInt(str){
>   if (!str || (typeof str == "undefined")) {
>     return str;
>   }
>   // first convert anything to string
>   var result = "" + str;
>   if (result.charAt(0)=="0") {
>     //truncate 0 for number less than 10
>     return result.charAt(1);
>   } else {
>     return result;
>   }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message