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


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

Reply via email to