I have a form that has a checkbox that controls a group of radio buttons.
One of the radio buttons has a text field associated with it. I only want
the text field to be validated if both the checkbox and the radio button are
turned "on", and when validated, validated as an integer.
I am using Validator in Struts 1.2.7, and I have the following in my
validator.xml:
<form name="secureForm">
...
<field property="theTextBox" depends="validwhen,integer">
<arg0 key="textbox.name"/>
<var>
<var-name>test</var-name>
<var-value>
(((theCheckbox == "false") or (theRadioGroup != "radio1")) or (*this*
!= null))
</var-value>
</var>
</field>
...
</form>
So, the way it is behaving:
1) if the checkbox is checked and the radio1 radio button is selected and
the text box is empty, I get a message saying the text box is required.
Good.
2) if the checkbox is checked and different radio button is selected and the
text box is empty, I don't get any error message. Good.
3) if the checkbox is checked or unchecked and a different radio button is
selected and the text box contains an invalid integer (like the letter 'w'),
then I get a error saying that it must contain a valid integer. BUT, I
don't want it to do the integer validation unless the checkbox and the
radio1 radio button are checked/selected.
Is there something more I need to specify or specify it in a different way
so that the integer validation is not performed? Is this not supported?
Thanks,
-Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]