You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Stephane Vandenbussche (JIRA)" <de...@myfaces.apache.org> on 2006/01/20 10:45:42 UTC

[jira] Created: (MYFACES-1045) formatInt does not accept numerical values, which causes JS exception when selecting year from dropdown list.

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


[jira] Updated: (MYFACES-1045) formatInt does not accept numerical values, which causes JS exception when selecting year from dropdown list.

Posted by "Stephane Vandenbussche (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-1045?page=all ]

Stephane Vandenbussche updated MYFACES-1045:
--------------------------------------------

    Attachment: popcalendar.js

This file contains the fix that allows formatint to be more robust and solves the numerical value bug.

> 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


[jira] Commented: (MYFACES-1045) formatInt does not accept numerical values, which causes JS exception when selecting year from dropdown list.

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ 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


[jira] Commented: (MYFACES-1045) formatInt does not accept numerical values, which causes JS exception when selecting year from dropdown list.

Posted by "Stephane Vandenbussche (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1045?page=comments#action_12364551 ] 

Stephane Vandenbussche commented on MYFACES-1045:
-------------------------------------------------

Never mind the previously proposed function, just correct the 1.1.0 version using the 1.1.1 implementation.

> 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