You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Carl Walker <wa...@georgetown.edu> on 2004/02/12 14:36:26 UTC
validation.xml and java.sql.Date
Hi,
I'm having a problem setting an initial value for a DynaValidatorForm. I have a date field that is not required to be filled in. However, when I submit the form without a value, I get a Date.valueOf exception thrown from SQLConverter.
If I submit a valid value or attempt to submit a bogus (non-NULL) value, everything works.
This is from my struts-config.xml file.
<form-property name="dateOfPO" type="java.sql.Date" />
Here is the validation.xml entry.
<field property="dateOfPO" depends="date">
<arg0 key="label.dateOfPO" />
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: validation.xml and java.sql.Date
Posted by Mark Lowe <ma...@talk21.com>.
You can have a string that looks like a date and validator will still
validate it. To my knowledge there is no need to have the property of
type Date. same is true of other types also.
On 12 Feb 2004, at 14:36, Carl Walker wrote:
> Hi,
>
> I'm having a problem setting an initial value for a DynaValidatorForm.
> I have a date field that is not required to be filled in. However,
> when I submit the form without a value, I get a Date.valueOf exception
> thrown from SQLConverter.
>
> If I submit a valid value or attempt to submit a bogus (non-NULL)
> value, everything works.
>
> This is from my struts-config.xml file.
>
> <form-property name="dateOfPO" type="java.sql.Date" />
>
> Here is the validation.xml entry.
>
> <field property="dateOfPO" depends="date">
> <arg0 key="label.dateOfPO" />
> <var>
> <var-name>datePatternStrict</var-name>
> <var-value>yyyy-MM-dd</var-value>
> </var>
> </field>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org