tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anatol Pomazau" <Anatol_Poma...@epam.com>
Subject RE: org.apache.tapestry.valid.DateValidator usage?
Date Tue, 12 Aug 2003 09:08:31 GMT
That appears cause default dateFormat use setLenient(true) by default.

If you want to switch lenity to false you must set 'format' property with your own java.text.DateFormat
object instance.

    public DateFormat getMyDateFormat()
    {
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
        dateFormat.setLenient(false);
        return dateFormat;
    }

I hope this helps


Sincerely,
Anatol Pomazau 
Java Developer, Unit 121
 
EPAM Systems, Minsk, Belarus
work: +375 17 210 1662, ext. #1373
Anatol_Pomazau@epam.com



-----Original Message-----
From: Roman "Blade" Velichko [mailto:blade@ivc.tagmet.ru] 
Sent: Tuesday, August 12, 2003 11:52 AM
To: Tapestry Users
Subject: Q: org.apache.tapestry.valid.DateValidator usage?


Hi to All!

How can properly use org.apache.tapestry.valid.DateValidator


<!-- My Page -->
<bean name="delegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
<bean name="dateValidator" class="org.apache.tapestry.valid.DateValidator">
      <set-string-property name="displayFormat" key="dd.MM.yyyy"/>
      <set-property name="required" expression="false"/> </bean> <component
id="inputBirthdate" type="ValidField">
      <binding name="validator" expression="beans.dateValidator"/>
      <binding name="value" expression="birthdate"/>
      <static-binding name="displayName">Birthdate</static-binding>
</component>
<component id="labelBirthdate" type="FieldLabel">
      <binding name="field" expression="components.inputBirthdate"/>
</component>

Than if I enter in my html-form value '13.13.2003' for field "inputBirthdate", I expect validation
error, BUT value become '01.13.2004'. Why it happend. :-))

========
With best wishes
Roman "Blade" Velichko [mailto:blade@ivc.tagmet.ru]

Chance favour to prepared mind


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


Mime
View raw message