Huh?  How come nobody noticed this before?

Shouldn't the for statement be like this:

---------------------------------------------------------------------
                for (var n = startFrom; n < argvalue.length; n++) {
                    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1)
return false;
                }

Assigning var n =0; doesn't make sense to me ....
----------------------------------------------------------------------
            function isAllDigits(argvalue) {
                argvalue = argvalue.toString();
                var validChars = "0123456789";
                var startFrom = 0;
                if (argvalue.substring(0, 2) == "0x") {
                   validChars = "0123456789abcdefABCDEF";
                   startFrom = 2;
                } else if (argvalue.charAt(0) == "0") {
                   validChars = "01234567";
                   startFrom = 1;
                }
                for (var n = 0; n < argvalue.length; n++) {
                    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1)
return false;
                }
                return true;
            }
-------------------------------------------------------------



-----Original Message-----
From: Yansheng Lin [mailto:[EMAIL PROTECTED] 
Sent: June 18, 2003 4:23 PM
To: 'Struts Users Mailing List'
Subject: RE: Validator problem with integers



Oh yeah. Sorry

Well, at least I pinpointed where the check failed:).



>There is a js function called isAllDigits(arg) in validator-rules.xml.  
>It's
>used by validateInteger().  You can use that.

No you can't because that function validates based on the type of number 
(int, octal, etc).

David

>
>Yan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to