You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2006/01/14 16:30:03 UTC
How do you get date validation to work?
I am running tap4.0 and I am struggling with date validation. The
documentation is a bit sparse and both things I tried didn't work.
Careful reading of the docs implies you should be able to do this
<input jwcid="xadate@DatePicker"
size="11" tabindex="4"
value="ognl:t.date"
validators="validator:date,minimum=1/1/1999,maximum=1/1/2030"
translator="translator:date,pattern=dd-MMM-yy"
displayName="message:date"/>
but I get a ClassCastException when I do
I also tried this
validators="validators:minDate=1/1/1999,maxDate=1/1/2030"
as a replacement validators line, but whilst that allowed the page to work it
accepted any rubbish in the date field and just defaulted it to today. I
want it to generate an error for my form validation delegate.
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: How do you get date validation to work?
Posted by Bryan Lewis <br...@maine.rr.com>.
Looking at the Tap4 examples... you can always define a bean to specify
arbitrary validators:
Dates.page:
<bean name="required"
class="org.apache.tapestry.form.validator.Required"></bean>
<bean name="maxDate" class="org.apache.tapestry.form.validator.MaxDate">
<set name="maxDate" value="new java.util.Date()"></set>
</bean>
<bean name="minDate" class="org.apache.tapestry.form.validator.MinDate">
<set name="minDate" value="new java.util.Date()"></set>
</bean>
Dates.html:
<input jwcid="startDate@DatePicker" includeWeek="ognl:includeWeek"
value="ognl:startDate" displayName="Start Date"
validators="ognl:{beans.required,beans.maxDate}"/>
Alan Chandler wrote:
>I am running tap4.0 and I am struggling with date validation. The
>documentation is a bit sparse and both things I tried didn't work.
>
>Careful reading of the docs implies you should be able to do this
>
><input jwcid="xadate@DatePicker"
> size="11" tabindex="4"
> value="ognl:t.date"
> validators="validator:date,minimum=1/1/1999,maximum=1/1/2030"
> translator="translator:date,pattern=dd-MMM-yy"
> displayName="message:date"/>
>
>but I get a ClassCastException when I do
>
>I also tried this
>
> validators="validators:minDate=1/1/1999,maxDate=1/1/2030"
>
>as a replacement validators line, but whilst that allowed the page to work it
>accepted any rubbish in the date field and just defaulted it to today. I
>want it to generate an error for my form validation delegate.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: How do you get date validation to work?
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Saturday 14 January 2006 15:30, Alan Chandler wrote:
> I am running tap4.0 and I am struggling with date validation. The
> documentation is a bit sparse and both things I tried didn't work.
>
> Careful reading of the docs implies you should be able to do this
...>
> I also tried this
>
> validators="validators:minDate=1/1/1999,maxDate=1/1/2030"
It was a coding bug that didn't check the value of my validation delegate
properly. So I fixed it and it works now.
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org