struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michelle Wynn" <mw...@csc.com>
Subject Re: restricting to a specific field length
Date Tue, 17 Dec 2002 23:10:49 GMT

Thanks -- I ended up creating a mask for the number of characters I need
then used a custom msg attribute to override the default make error.  But I
could do the same with what you propose as well.


                                                                                         
                                       
                      "David Graham"                                                     
                                       
                      <dgraham1980@hotm        To:       struts-user@jakarta.apache.org
                                         
                      ail.com>                 cc:                                    
                                          
                                               Subject:  Re: restricting to a specific field
length                              
                      12/17/2002 05:56                                                   
                                       
                      PM                                                                 
                                       
                      Please respond to                                                  
                                       
                      "Struts Users                                                      
                                       
                      Mailing List"                                                      
                                       
                                                                                         
                                       
                                                                                         
                                       




You could give the field a maxlength attribute and then use the minlength
validator to make sure it's the given number of characters.

David






>From: "Michelle Wynn" <mwynn@csc.com>
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>Subject: restricting to a specific field length
>Date: Tue, 17 Dec 2002 16:45:44 -0500
>
>
>I want to validate a field that must be alphanumeric and must be a X
number
>of characters long.   Is there a clean way to leverage the basic struts
>validators for this or does this have to be a custom validation?
>
>I know I could use a combination of the minlength and maxlength functions
>but this sounds like a sloppy way to go.  I don't want to give them 2
error
>messages when I just want to say "Your field must be X characters" (as
>opposed to "Your field cannot be less than X" and/or"Your field cannot be
>greater than X").
>
>I could mask out to the desired number of characters but I want the error
>message to say something more meaningful than "The field is invalid".
>
>Any one deal with this before?
>
>Thanks!
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:struts-user-help@jakarta.apache.org>


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>







--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message