struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Problem with validation using both minlength and maxlength on the same field
Date Wed, 01 Dec 2004 17:49:26 GMT
I'm trying to validate a simple field.  I want to validate that the field 
is an integer, and meets the min and max length requirements.  In the same 
application I am able to correctly validate a date field so I'm confident 
my overall struts setup is correct.  However when I try to do both a min 
and max length check on the same field, the max length check doesn't work. 
 If I exceed the max length I get the min length message.  Below is a 
snippet from my validation.xml file.  I've setup my properties file to 
include the min and max length constants.

           depends="minlength, maxlength, integer">
           <arg0 key="sampleApp.myField.label"/>
           <arg1 key="sampleApp.myField.minLen" name="minlength"  />
           <arg1 key="sampleApp.myField.maxLen" name="maxlength"  />
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.{0} is not a date.
   errors.range={0} is not in the range {1} through {2}.{0} is an invalid credit card number.{0} is an invalid e-mail address.
   sampleApp.myField.label=My field:

If I enter 8 charcters in myField and submit I get "My field: can not be 
less than 5 characters."

Any ideas what's wrong?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message