This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have a situation to use valid when/requiredif.When number of years at address is less than 2 yrs i have to validate previous address.
This is the entry i have in validation.xml
<field property="prevAddressLine1" depends="required, requiredif"> <arg0 key="situation.streetAddress"/> <arg1 key="situation.streetAddress"/> <var> <var-name>test</var-name> <var-value>((numYrsAtAddr != " Less Than 24 Months"))</var-value> </var> </field>
prevAddressLine1 refers to form2 and numYrsAtAddr refers to form1. Is there any way i can do this??
Naseem Khan
Ranch Hand
Joined: Apr 25, 2005
Posts: 809
posted
0
When you want to create your own validation rules, then you can use apache's common-validation project. common-validation jar already comes with your struts.
The advantage which validation rules give is that you can reuse same rule for different form on fly without rewriting sam logic again and it promotes reusability.
Thing which is not clear
When number of years at address is less than 2 yrs i have to validate previous address.
When the entered value of someTextField is less than 2 yrs, then you want to trigger some validation routine and want to show error message.