I am having problem validating a text field if another text-box is filled.
I ws trying to use requiredif or validwhen methods from validator-rules but it doesnt work. Could someone suggest what I'm doing wrong.
This is the validwhen in Validator-rules.xml
<validator name="validwhen"
classname="org.apache.struts.validator.validwhen.ValidWhen"
method="validateValidWhen"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.required">
</validator>
This is my Valiadtions.xml entry:
<field
property="conName2"
depends="validwhen">
<arg0 key="SupplierContactsForm.conName2"/>
<var>
<var-name>
test</var-name>
<var-value>((location2== null) or (*this* != null))</var-value>
</var>
</field>
ConName2 and location2 are the two textboxes I ahve on my
jsp page.
I have all other things in place, the required validations is working on the same page.