• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with validwhen rule

 
Jeremy Stoneburner
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Usera User
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also have the same problem, validwhen seems not work. I am using struts 1.2.7 and validator 1.1.3. I view the generated web page source code and find that no javascript function has been generated for the validwhen logic. Has any people known how to solve ? Thanks
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic