You need to specify a date format to get the date validator to work.

<bean name="dateTimeValidator"
class="org.apache.tapestry.valid.DateValidator">
        <set-property name="Format"
expression="visit.currentUser.dateTimeFormat" />
    </bean>

<component id="exit" type="ValidField">
        <binding name="value" expression="object.exit"/>
        <binding name="validator" expression="beans.dateTimeValidator"/>
        <static-binding name="displayName" value="Date Exited:"/>
    </component>

        The Format property uses the standard java date format strings e.g.
"MM/dd/yy HH:mm:ss".

        If you want every user to potentially have a different date format
it's a good idea to derive your date format from your user object, even if
it's just a stub method that returns a static. That way if you ever need to
internationalize you'll have the infrastructure in place.

        You could, of course, specify a litteral, but then you're just
buying yourself some pain later on when i18n pops up.

        --- Pat
> -----Original Message-----
> From: Radim Burget [mailto:[EMAIL PROTECTED]
> Sent: Sunday, July 31, 2005 5:10 AM
> To: [email protected]
> Subject: Validation - newbie question
> 
> Hi,
> (just newbie)
> I need a "datePicker" and validate input as required field with
> "dateValidator". Is it possible?
> 
> Many thanks for any help.
> Radim
> --------------------------
> Separatelly I have manneged both:
> 1] date picker:
> 
> <bean name="stringValidator" class="net.sf.tapestry.valid.StringValidator"
> lifecycle="page">
>               <set-property name="required" expression="true"/>
>               <set-property name="clientScriptingEnabled"
> expression="true"/>
> </bean>
> 
> 2] dateValidator:
> 
> <bean name="dateValidator" class="net.sf.tapestry.valid.DateValidator"
> lifecycle="page">
>               <set-property name="required" expression="true"/>
>               <set-property name="clientScriptingEnabled"
> expression="true"/>
> </bean>
> 
> <component id="dateOfBirth" type="ValidField">
>       <binding name="value" expression="visit.dateOfBirth"/>
>     <binding name="validator" expression='beans.dateValidator'/>
>     <static-binding name="displayName">Date of birth</static-binding>
> </component>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to