dgraham     2003/06/24 18:32:31

  Modified:    src/share/org/apache/struts/validator FieldChecks.java
  Log:
  The max length javascript validation considers whitespace as a character.  The server
  side max length check does *not* consider whitespace when comparing 
  the number of characters to the maximum allowed.  The javascript is correct
  so revert validateMaxLength() logic to how it was in revision 1.6.  
  
  Whitespace *should* count against the total number of characters in a string.
  An example is a database field defined as CHAR(2).  The maxlength validation should
  limit the input to 2 characters regardless of their type.  If it didn't, and I input 
3 space
  characters the validation would pass and the database would throw an error.
  
  Revision  Changes    Path
  1.10      +4 -4      
jakarta-struts/src/share/org/apache/struts/validator/FieldChecks.java
  
  Index: FieldChecks.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/validator/FieldChecks.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- FieldChecks.java  4 Jun 2003 02:50:58 -0000       1.9
  +++ FieldChecks.java  25 Jun 2003 01:32:31 -0000      1.10
  @@ -810,7 +810,7 @@
               value = ValidatorUtil.getValueAsString(bean, field.getProperty());
           }
   
  -        if (!GenericValidator.isBlankOrNull(value)) {
  +        if (value != null) {
               try {
                   int max = Integer.parseInt(field.getVarValue("maxlength"));
   
  
  
  

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

Reply via email to