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 package.html validateByte.js validateDate.js validateEmail.js validateFloat.js validateFloatRange.js validateIntRange.js validateInteger.js validateMask.js validateMaxLength.js validateMinLength.js validateRequired.js validateShort.js
Date Mon, 02 Feb 2004 23:58:52 GMT
rleland     2004/02/02 15:58:52

  Modified:    validator/src/javascript/org/apache/commons/validator/javascript
                        package.html validateByte.js validateDate.js
                        validateEmail.js validateFloat.js
                        validateFloatRange.js validateIntRange.js
                        validateInteger.js validateMask.js
                        validateMaxLength.js validateMinLength.js
                        validateRequired.js validateShort.js
  Log:
  Bug 26584 - Add Support for hidden fields in validations.
  
  Revision  Changes    Path
  1.3       +31 -2     jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/package.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- package.html	15 Dec 2003 06:10:51 -0000	1.2
  +++ package.html	2 Feb 2004 23:58:52 -0000	1.3
  @@ -1,9 +1,9 @@
  -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Final//EN">
   <html>
   <head>
     <title>Validator JavaScript package</title>
   </head>
  -<body style="background-color: white;">
  +<body>
   <p> The validator javascript package provides a series of functions to
   validate <code>form input data</code>.</p>
   <br>
  @@ -12,6 +12,7 @@
   <table cellpadding="2" cellspacing="2" border="1"
    style="text-align: left; width: 100%; height: 310px;"
    title="Input fields and their validations">
  +
     <tbody>
       <tr>
         <td
  @@ -129,6 +130,34 @@
    alt="Yes" style="width: 15px; height: 15px;"></td>
         <td style="vertical-align: top;"><br>
         </td>
  +    </tr>
  +    <tr>
  +      <td style="vertical-align: top;">hidden</td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;">&nbsp;</td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
  +      <td style="vertical-align: top;"><img
  + style="width: 15px; height: 15px;" alt="Yes" src="doc-files/sm-yes.gif"></td>
       </tr>
       <tr>
         <td style="vertical-align: top;">password</td>
  
  
  
  1.6       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateByte.js
  
  Index: validateByte.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateByte.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateByte.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateByte.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -15,7 +15,8 @@
           for (x in oByte) {
               var field = form[oByte[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'select-one' ||
                   field.type == 'radio')  &&
  
  
  
  1.7       +14 -12    jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateDate.js
  
  Index: validateDate.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateDate.js,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- validateDate.js	15 Dec 2003 02:56:57 -0000	1.6
  +++ validateDate.js	2 Feb 2004 23:58:52 -0000	1.7
  @@ -13,15 +13,17 @@
          var fields = new Array();
          oDate = new DateValidations();
          for (x in oDate) {
  -           var value = form[oDate[x][0]].value;
  +           var field = form[oDate[x][0]];
  +           var value = field.value;
              var datePattern = oDate[x][2]("datePatternStrict");
              // try loose pattern
              if (datePattern == null)
                  datePattern = oDate[x][2]("datePattern");
  -           if ((form[oDate[x][0]].type == 'text' ||
  -                form[oDate[x][0]].type == 'textarea') &&
  +           if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
  +                field.type == 'textarea') &&
                  (value.length > 0) && (datePattern.length > 0) &&
  -                form[oDate[x][0]].disabled == false) {
  +                field.disabled == false) {
                    var MONTH = "MM";
                    var DAY = "dd";
                    var YEAR = "yyyy";
  @@ -46,14 +48,14 @@
                        if(matched != null) {
                           if (!isValidDate(matched[2], matched[1], matched[3])) {
                              if (i == 0) {
  -                               focusField = form[oDate[x][0]];
  +                               focusField = field;
                              }
                              fields[i++] = oDate[x][1];
                              bValid =  false;
                           }
                        } else {
                           if (i == 0) {
  -                            focusField = form[oDate[x][0]];
  +                            focusField = field;
                           }
                           fields[i++] = oDate[x][1];
                           bValid =  false;
  @@ -76,14 +78,14 @@
                        if(matched != null) {
                            if (!isValidDate(matched[1], matched[2], matched[3])) {
                                if (i == 0) {
  -                         focusField = form[oDate[x][0]];
  +                         focusField = field;
                                }
                                fields[i++] = oDate[x][1];
                                bValid =  false;
                             }
                        } else {
                            if (i == 0) {
  -                             focusField = form[oDate[x][0]];
  +                             focusField = field;
                            }
                            fields[i++] = oDate[x][1];
                            bValid =  false;
  @@ -106,21 +108,21 @@
                        if(matched != null) {
                            if (!isValidDate(matched[3], matched[2], matched[1])) {
                                if (i == 0) {
  -                                 focusField = form[oDate[x][0]];
  +                                 focusField = field;
                                }
                                fields[i++] = oDate[x][1];
                                bValid =  false;
                            }
                        } else {
                             if (i == 0) {
  -                              focusField = form[oDate[x][0]];
  +                              focusField = field;
                             }
                             fields[i++] = oDate[x][1];
                             bValid =  false;
                        }
                    } else {
                        if (i == 0) {
  -                         focusField = form[oDate[x][0]];
  +                         focusField = field;
                        }
                        fields[i++] = oDate[x][1];
                        bValid =  false;
  
  
  
  1.6       +9 -7      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
  
  Index: validateEmail.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateEmail.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateEmail.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateEmail.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -13,13 +13,15 @@
           var fields = new Array();
           oEmail = new email();
           for (x in oEmail) {
  -            if ((form[oEmail[x][0]].type == 'text' ||
  -                 form[oEmail[x][0]].type == 'textarea') &&
  -                (form[oEmail[x][0]].value.length > 0) &&
  -                form[oEmail[x][0]].disabled == false) {
  -                if (!checkEmail(form[oEmail[x][0]].value)) {
  +            var field = form[oEmail[x][0]];
  +            if ((field.type == 'hidden' || 
  +                 field.type == 'text' ||
  +                 field.type == 'textarea') &&
  +                (field.value.length > 0) &&
  +                field.disabled == false) {
  +                if (!checkEmail(field.value)) {
                       if (i == 0) {
  -                        focusField = form[oEmail[x][0]];
  +                        focusField = field;
                       }
                       fields[i++] = oEmail[x][1];
                       bValid = false;
  
  
  
  1.8       +3 -2      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- validateFloat.js	15 Dec 2003 02:56:57 -0000	1.7
  +++ validateFloat.js	2 Feb 2004 23:58:52 -0000	1.8
  @@ -15,7 +15,8 @@
           for (x in oFloat) {
           	var field = form[oFloat[x][0]];
           	
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'select-one' ||
                   field.type == 'radio') &&
  
  
  
  1.6       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
  
  Index: validateFloatRange.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateFloatRange.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateFloatRange.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -15,7 +15,8 @@
           for (x in oRange) {
               var field = form[oRange[x][0]];
               
  -            if ((field.type == 'text' || field.type == 'textarea') &&
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' || field.type == 'textarea') &&
                   (field.value.length > 0)  &&
                    field.disabled == false) {
           
  
  
  
  1.7       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
  
  Index: validateIntRange.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- validateIntRange.js	15 Dec 2003 02:56:57 -0000	1.6
  +++ validateIntRange.js	2 Feb 2004 23:58:52 -0000	1.7
  @@ -16,7 +16,8 @@
               var field = form[oRange[x][0]];
               if (field.disabled == false)  {
                   var value = '';
  -                if (field.type == 'text' || field.type == 'textarea' ||
  +                if (field.type == 'hidden' ||
  +                    field.type == 'text' || field.type == 'textarea' ||
                       field.type == 'radio' ) {
                       value = field.value;
                   }
  
  
  
  1.6       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
  
  Index: validateInteger.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateInteger.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateInteger.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateInteger.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -15,7 +15,8 @@
           for (x in oInteger) {
               var field = form[oInteger[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'select-one' ||
                   field.type == 'radio') &&
  
  
  
  1.6       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMask.js
  
  Index: validateMask.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMask.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateMask.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateMask.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -15,7 +15,8 @@
           for (x in oMasked) {
               var field = form[oMasked[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                    field.type == 'textarea') &&
                    (field.value.length > 0) &&
                    field.disabled == false) {
  
  
  
  1.7       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
  
  Index: validateMaxLength.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- validateMaxLength.js	15 Dec 2003 02:56:57 -0000	1.6
  +++ validateMaxLength.js	2 Feb 2004 23:58:52 -0000	1.7
  @@ -3,6 +3,7 @@
       /**
       * A field is considered valid if less than the specified maximum.
       * Fields are not checked if they are disabled.
  +    * <p>
       * <strong>Caution:</strong> Using <code>validateMaxLength</code>
on a password field in a 
       *  login page gives unnecessary information away to hackers. While it only slightly
       *  weakens security, we suggest using it only when modifying a password.</p>
  @@ -17,7 +18,8 @@
           for (x in oMaxLength) {
               var field = form[oMaxLength[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'password' ||
                   field.type == 'textarea') &&
                   field.disabled == false) {
  
  
  
  1.8       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
  
  Index: validateMinLength.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- validateMinLength.js	15 Dec 2003 02:56:57 -0000	1.7
  +++ validateMinLength.js	2 Feb 2004 23:58:52 -0000	1.8
  @@ -18,7 +18,8 @@
           for (x in oMinLength) {
               var field = form[oMinLength[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'password' ||
                   field.type == 'textarea') &&
                   field.disabled == false) {
  
  
  
  1.10      +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
  
  Index: validateRequired.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateRequired.js,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- validateRequired.js	15 Dec 2003 02:56:57 -0000	1.9
  +++ validateRequired.js	2 Feb 2004 23:58:52 -0000	1.10
  @@ -17,7 +17,8 @@
           for (x in oRequired) {
               var field = form[oRequired[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'file' ||
                   field.type == 'checkbox' ||
  
  
  
  1.6       +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateShort.js
  
  Index: validateShort.js
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateShort.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- validateShort.js	15 Dec 2003 02:56:57 -0000	1.5
  +++ validateShort.js	2 Feb 2004 23:58:52 -0000	1.6
  @@ -15,7 +15,8 @@
           for (x in oShort) {
               var field = form[oShort[x][0]];
   
  -            if ((field.type == 'text' ||
  +            if ((field.type == 'hidden' ||
  +                field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'select-one' ||
                   field.type == 'radio')  &&
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message