You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rodrigo Pereira <ro...@gmail.com> on 2008/04/05 19:59:47 UTC
[S2] Date Validation
Hi,
how can I validate a datetime picker?
I have the following in my validation.xml file:
<field name="date">
<field-validator type="required">
<message key="errors.date.required"/>
</field-validator>
</field>
but I am getting this error message:
05/04/2008 14:53:41 org.apache.struts2.components.DateTimePicker format
SEVERE: Could not parse date
java.text.ParseException: Unparseable date: ""
If I comment this field validation, all the rest of my validation on this form work.
Does anybody have an idea what I am doing wrong?
Thanks,
Rodrigo Pereira
Re: [S2] Date Validation
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Rodrigo Pereira wrote:
> Hi,
> how can I validate a datetime picker?
>
> ...
>
> SEVERE: Could not parse date
>
> java.text.ParseException: Unparseable date: ""
>
>
>
I don't think that's caused by the validation.
That error occurs when the DatePicker attempts to set its current value
but the value is an invalid format. In this case it's blank.
My guess is that the params have been set on your action, validation is
invoked on the action, validation failed because the Date (or another
field) wasn't set, the input result was returned, the page was
redisplayed but the DatePicker failed to render itself because the date
value was null.
Use an s:property or s:date to see what the date value is after a
validation failure.
Hope that helps.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org