Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struts validation of dates

Status
Not open for further replies.

KiwiJavaHead

Programmer
Jul 15, 2003
2
NZ
Hi there. I am a struts newbie and have encountered a problem when attempting to validate a date field on a simple Form. The String fields validate as expected but the date fields do not appear to be validated at all. Most frustrating! My code in validate.xml is:
<form name=&quot;TourForm&quot;>

<field property=&quot;tour.tourID&quot; depends=&quot;required,maxlength&quot;>
<arg0 key=&quot;tourform.tourid&quot;/>
<arg1 name=&quot;maxlength&quot; key=&quot;${var:maxlength}&quot; resource=&quot;true&quot;/>

<var>
<var-name>maxlength</var-name>
<var-value>15</var-value>
</var>

</field>
<field
property=&quot;tour.description&quot;
depends=&quot;required,maxlength&quot;>
<arg0 key=&quot;tourform.description&quot;/>
<arg1 name=&quot;maxlength&quot; key=&quot;${var:maxlength}&quot; resource=&quot;true&quot;/>
<var>
<var-name>maxlength</var-name>
<var-value>50</var-value>
</var>

</field>

<field
property=&quot;tour.startAt&quot; depends=&quot;required,date&quot;>
<msg name=&quot;date&quot; key=&quot;errors.date&quot;/>
<arg0 name=&quot;date&quot; key=&quot;tourform.startAt&quot; resource=&quot;true&quot;/>

<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>

<field property=&quot;tour.endAt&quot;

depends=&quot;required,date&quot;>

<arg0 key=&quot;tourform.endAt&quot;/>

<var>

<var-name>datePatternStrict</var-name>

<var-value>yyyy-MM-dd</var-value>

</var>

</field>

<field property=&quot;tour.maxCapacity&quot;

depends=&quot;required,integer&quot;>

<arg0 key=&quot;tourform.maxCapacity&quot;/>

</field>

<field property=&quot;tour.minCapacity&quot;

depends=&quot;required,integer&quot;>

<arg0 key=&quot;tourform.minCapacity&quot;/>

</field>



<field property=&quot;tour.singleCost&quot;

depends=&quot;required,double&quot;>

<arg0 key=&quot;tourform.singleCost&quot;/>

</field>

<field property=&quot;tour.doubleCost&quot;

depends=&quot;required,double&quot;>

<arg0 key=&quot;tourform.doubleCost&quot;/>

</field>

</form>

Sorry about the formatting. Any ideas please??


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top