dgraham     2003/06/24 18:08:13

  Modified:    conf/share validator-rules.xml
  Log:
  Trim whitespace before checking length in validateRequired.  PR# 21051.
  
  Revision  Changes    Path
  1.32      +9 -2      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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- validator-rules.xml       7 May 2003 00:41:49 -0000       1.31
  +++ validator-rules.xml       25 Jun 2003 01:08:12 -0000      1.32
  @@ -81,7 +81,7 @@
                                                        value = field.value;
                                                }
                           
  -                        if (value == '') {
  +                        if (trim(value).length == 0) {
                           
                                if (i == 0) {
                                    focusField = field;
  @@ -96,7 +96,14 @@
                      alert(fields.join('\n'));
                   }
                   return isValid;
  -            }]]>
  +            }
  +            
  +            // Trim whitespace from left and right sides of s.
  +            function trim(s) {
  +                return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
  +            }
  +            
  +            ]]>
            </javascript>
   
         </validator>
  
  
  

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

Reply via email to