You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim Penhey <ti...@penhey.net> on 2004/06/03 09:37:09 UTC

Dynamic validation and dates

Does the DynaValidatorForm handle java.util.Date?  
If it does, how does it handle I18N for input?

Thanks,
Tim




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


RE: Dynamic validation and dates

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
usage in validation.xml:

<field property="fooDate" depends="required,date">
        <arg0 key="fooForm.fooDate"/>
        <var>
           <var-name>datePattern</var-name>
           <var-value>MM/dd/yyyy</var-value> <!-- or a locale ... ;-)
-->
       </var>
</field>

API of Validator-Framework said (FieldChecks.validateDate() of
org.apache.struts.validator-package):
Checks if the field is a valid date. If the field has a datePattern
variable, that will be used to format java.text.SimpleDateFormat. If the
field has a datePatternStrict variable, that will be used to format
java.text.SimpleDateFormat  and the length will be checked so
'2/12/1999' will not pass validation with the format 'MM/dd/yyyy'
because the month isn't two digits. If no datePattern variable is
specified, then the field gets the DateFormat.SHORT format for the
locale. The setLenient method is set to false for all variations.

JavaDoc für DateFormat.SHORT said:
SHORT is completely numeric, such as 12.13.52 or 3:30pm

cheers,

> -----Original Message-----
> From: Tim Penhey [mailto:tim@penhey.net] 
> Sent: Thursday, June 03, 2004 9:37 AM
> To: Struts Users Mailing List
> Subject: Dynamic validation and dates
> 
> 
> Does the DynaValidatorForm handle java.util.Date?  
> If it does, how does it handle I18N for input?
> 
> Thanks,
> Tim
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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