Adam Gordon wrote:
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:

<var>
  <var-name>mask</var-name>
<var-value>^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(2
9|30)|(0?[13578]|1[02])/31)/(20)((0[6-9])|(10))|0?2/29/((20)(0[48])))$</var-
value>
</var>

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.
Holy lipton that's nuts.  I think I'll see what's behind door number 3:

public void setDate( String date )
{
this.date = translateDate( date ); // where translateDate inserts the slashes if necessary
}

So I can use the "date" validator with no problems, and when the client submits the form, they get back a slash-separated date in the input field.

Thanks for the help :)

- Scott


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

Reply via email to