I'm curently working on a project that is being implemented using struts 1.2.4 and tomcat 4.1.31. I need to be able to validate a field using the validwhen rule, but I can't seem to get it to work. Here is the code from the validation.xml I'm trying to use.
<field property="minorityOth" depends="validwhen"> <arg0 key="person.info.other" /> <var> <var-name>test</var-name> <var-value>(((*this* == null) and (minority != "Other")) or (*this* != null) and (minority == "Other"))</var-value> </var> </field>
minority is the name of a set of Radio buttons with one of the values being "Other" and minorityOth is a text field. The form is supposed to validate the text field if the user selects the "Other" radio button and enters something into the text field, or if the user selects a different radio button and leaves the text field blank. The problem I'm having is that the validation doesn't seem to be getting applied. Regardless of what combinations I've tried, I can't get an error message out of it. Anyone have any advice?
posted 10 years ago