File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Help with validwhen rule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help with validwhen rule" Watch "Help with validwhen rule" New topic
Author

Help with validwhen rule

Jeremy Stoneburner
Greenhorn

Joined: Jul 11, 2005
Posts: 3
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

Joined: Jul 13, 2005
Posts: 21
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
 
GeeCON Prague 2014
 
subject: Help with validwhen rule