• 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

validwhen - struts validation

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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>
<var-name>test</var-name>
<var-value>((isAge == 'true') and (*this* == null))</var-value>
</var>
<msg key="error.age.integer" name="integer"/>
</field>
</form>

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

Thanks,
Gayatri
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic