You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rl...@apache.org on 2003/10/31 07:20:34 UTC

cvs commit: jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript validateRequired.js

rleland     2003/10/30 22:20:34

  Modified:    validator/src/javascript/org/apache/commons/validator/javascript
                        validateRequired.js
  Log:
  Bug 24202
  Add required check for single checkbox,
  Bug report/patch by Saul Q Yuan
  
  Revision  Changes    Path
  1.7       +8 -3      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- validateRequired.js	22 Oct 2003 07:20:57 -0000	1.6
  +++ validateRequired.js	31 Oct 2003 06:20:34 -0000	1.7
  @@ -16,6 +16,7 @@
               if (field.type == 'text' ||
                   field.type == 'textarea' ||
                   field.type == 'file' ||
  +                field.type == 'checkbox' ||
                   field.type == 'select-one' ||
                   field.type == 'password') {
   
  @@ -25,6 +26,10 @@
                       var si = field.selectedIndex;
                       if (si >= 0) {
                           value = field.options[si].value;
  +                    }
  +                } else if (field.type == 'checkbox') {
  +                    if (field.checked) {
  +                        value = field.value;
                       }
                   } else {
                       value = field.value;
  
  
  

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