• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with validwhen rule

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic