my dog learned polymorphism*
The moose likes Struts and the fly likes validwhen - struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validwhen - struts validation" Watch "validwhen - struts validation" New topic
Author

validwhen - struts validation

Gayatri Ganesh
Ranch Hand

Joined: Dec 23, 2003
Posts: 143
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
 
Don't get me started about those stupid light bulbs.
 
subject: validwhen - struts validation
 
Similar Threads
Struts 1.1 validation help on Requiredif
use of requiredIf in validation.xml
How to Bypass struts validation
validate two passwords in struts
Struts: validations using 'validwhen' in validation.xml