struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Gordon <>
Subject RE: Accepting multiple date masks with the "date" validator
Date Thu, 03 Aug 2006 15:16:49 GMT
IIOC, the only way you can do this with the stock validator is to use "mask"
rather than "date" as the validator.  Then, you can use a regex to dictate
your mask.  I'll warn you though, if you use a regular expression it's going
to be VERY long because it will also need to validate that the date entered
is valid.  Additionally, the stock date validator accepts dates like 30 FEB
YYYY and just rolls it to the appropriate March date.  Here's the REGEX we
use (note that the regex is all on one line with no spaces:


Alternatively, you can override the validate method in your ValidatorForm
and do it yourself - which given your requirements, sounds like the easier
of the two options.


-----Original Message-----
From: Scott Van Wart [] 
Sent: Wednesday, 02 August 2006 14:59
Subject: Accepting multiple date masks with the "date" validator

I have a requirement in my project that I be able to accept two 
different date masks.  One with slashes (thus, 10 characters) and one 
without (8 digits).  Is there any way to do this with the stock date 
validator, or do I need to roll my own wrapper?


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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message