You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/06/25 03:08:13 UTC

cvs commit: jakarta-struts/conf/share validator-rules.xml

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: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org