aspose file tools
The moose likes Struts and the fly likes validwhen struts ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "validwhen struts ???" Watch "validwhen struts ???" New topic
Author

validwhen struts ???

Gayatri Ganesh
Ranch Hand

Joined: Dec 23, 2003
Posts: 143
Hi,

I have 2 fields on my screen, 1 is a textfield and the other is a drop-down.
When the drop-down has values A or B or C, the value allowed in the textfield should be a long only.
When the user selects anything else other than A,B,C from drop-down, the textfield can contain anything.

I am trying to use validwhen.


<field property="selectedDropDownItem" depends="validwhen">
<msg key="error.invalid" name="validwhen"/>
<var>
<var-name>test</var-name>
<var-value>( ((*this* == 'A' ) and (id == [a-zA-Z])) or ((*this* == 'B' ) and (id == [a-zA-Z])) or ((*this* == 'C' ) and (id == [a-zA-Z])))</var-value>
</var>
</field>
id=[a-zA-Z] doesnt work nor does id =long.
How do I give id field a different validation rule only when selectedDropDownItem = A or B or C ?

Any help will be apprecaited.

Thanks,
Gayatri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validwhen struts ???
 
Similar Threads
why no errors shown for password validation in struts 1.2.4
Help with validation rules for form with multiple submit buttons
Struts Validation Problem
doubt in using validwhen
validwhen - struts validation