Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

validwhen - struts validation

Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I need to validate a field called age only when a boolean isAge is true, ie age is a required field only when boolean isAge is true.
And also age should be an integer only. I

In my validation.xml I have :

<form name="/a/b/c">
<field property="age" depends="validwhen,required,integer">
<arg0 key="errors.invalid"/>
<var-value>((isAge == 'true') and (*this* == null))</var-value>
<msg key="error.age.integer" name="integer"/>

But I always get the error message, even if I enetered a valid age.
Can anyone please tell me what is wrong ?

Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic