Return-Path: Delivered-To: apmail-jakarta-struts-dev-archive@apache.org Received: (qmail 7183 invoked from network); 20 Jan 2003 04:32:35 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 20 Jan 2003 04:32:35 -0000 Received: (qmail 28047 invoked by uid 97); 20 Jan 2003 04:34:02 -0000 Delivered-To: qmlist-jakarta-archive-struts-dev@jakarta.apache.org Received: (qmail 28007 invoked by uid 97); 20 Jan 2003 04:34:01 -0000 Mailing-List: contact struts-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list struts-dev@jakarta.apache.org Received: (qmail 27996 invoked by uid 97); 20 Jan 2003 04:34:00 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 20 Jan 2003 04:32:24 -0000 Message-ID: <20030120043224.71982.qmail@icarus.apache.org> From: turner@apache.org To: jakarta-struts-cvs@apache.org Subject: cvs commit: jakarta-struts/conf/share validator-rules.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N turner 2003/01/19 20:32:24 Modified: conf/share validator-rules.xml Log: Make validateInteger work for cases where the input string ends in a non-numeric (fixes bug 15913) Please bang on this a bit, Javascript isn't my forte and you can't unit test it. I tried for all the cases I could think of, and it seemed to work fine. James Revision Changes Path 1.21 +18 -0 jakarta-struts/conf/share/validator-rules.xml Index: validator-rules.xml =================================================================== RCS file: /home/cvs/jakarta-struts/conf/share/validator-rules.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- validator-rules.xml 9 Dec 2002 05:23:44 -0000 1.20 +++ validator-rules.xml 20 Jan 2003 04:32:24 -0000 1.21 @@ -404,6 +404,9 @@ if (value.length > 0) { + if (!isAllDigits(value)) { + bValid = false; + } else { var iValue = parseInt(value); if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) { if (i == 0) { @@ -412,6 +415,7 @@ fields[i++] = oInteger[x][1]; bValid = false; } + } } } } @@ -420,6 +424,20 @@ alert(fields.join('\n')); } return bValid; + } + + function isAllDigits(argvalue) { + argvalue = argvalue.toString(); + var validchars = "012345679"; + var startFrom = 0; + if (argvalue.substring(0, 2) == "0x") { + validchars = "012345679abcdefABCDEF"; + startFrom = 2; + } + for (var n = 0; n < argvalue.length; n++) { + if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false; + } + return true; }]]> -- To unsubscribe, e-mail: For additional commands, e-mail: