aspose file tools*
The moose likes Struts and the fly likes Validwhen validator question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validwhen validator question" Watch "Validwhen validator question" New topic

Validwhen validator question

Alok Pota
Ranch Hand

Joined: Mar 07, 2001
Posts: 185
I have two properties on a form (zip and country) and I would like to validate
a us-zip for country = 'USA' and canadian zip when the country is 'Canada'
How would one go about doing this using validwhen when I have the following
in my validation.xml


<!-- Zip -->
<constant-value>[A-Z]\d[A-Z] \d[A-Z]\d</constant-value>


<field property="zipcode" depends="validwhen, mask" page="1">
<arg0 key="Zip code" resource="false" />
<var-value>(country == "USA") and (*this* != null)))</var-value>

<field property="country" depends="mask, maxlength" page="1">
<arg0 key="Country" resource="false" />

Is it possible to add multiple tests to the validwhen validator
I agree. Here's the link:
subject: Validwhen validator question
Similar Threads
Exception while loading the validation.xml in strusts
why no errors shown for password validation in struts 1.2.4
struts 1.2.7 validation using validwhen
DynaValidatorActionForm not working
problem in using mask validation