You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/01/09 09:30:20 UTC

DO NOT REPLY [Bug 15913] New: - Client side validation for integer doesn't work properly.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15913>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15913

Client side validation for integer doesn't work properly.

           Summary: Client side validation for integer doesn't work
                    properly.
           Product: Struts
           Version: 1.1 Beta 2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: peter.tolmachov.pt@belgium.agfa.com


If a integer client side validation is set for a field of a form and a
value like '8x' is typed in, then validation consider this value as '8' and
doesn't show up warning message.

The problem is that parseInt('8x') returns 8.

possible solution:

in validateInteger(form) function 

these line 
...
if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
...

should be replaced with these two
...
var iValueStr = iValue + '';
if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647) || 
(field.value.length != iValueStr.length)) {
....

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>