commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlel...@apache.org
Subject cvs commit: jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript validateFloat.js
Date Fri, 15 Aug 2003 18:30:30 GMT
rleland     2003/08/15 11:30:30

  Modified:    validator/src/javascript/org/apache/commons/validator/javascript
                        validateFloat.js
  Log:
    Bug 22436
    	Strip off leading zero's so float is not mistaken for
                    a hex
  
  Revision  Changes    Path
  1.2       +8 -3      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
  
  Index: validateFloat.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloat.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- validateFloat.js	18 May 2003 21:34:41 -0000	1.1
  +++ validateFloat.js	15 Aug 2003 18:30:29 -0000	1.2
  @@ -27,9 +27,14 @@
                   if (value.length > 0) {
                       // remove '.' before checking digits
                       var tempArray = value.split('.');
  -                    var joinedString= tempArray.join('');
  - 
  -                    if (!isAllDigits(joinedString)) {
  +                    //Strip off leading '0'
  +                    var zeroIndex = 0;
  +                    while (joinedString.charAt(zeroIndex) == '0') {
  +                        zeroIndex++;
  +                    }
  +                    var noZeroString = joinedString.substring(zeroIndex,joinedString.length);
  +
  +                    if (!isAllDigits(noZeroString)) {
                           bValid = false;
                           if (i == 0) {
                               focusField = field;
  
  
  

Mime
View raw message