You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vivek Chauhan <si...@gmail.com> on 2007/08/10 14:40:09 UTC

S1-1.3.8 Validation using 'validwhen' for radio button

Hi,

I am trying to do a conditional validation using 'validwhen'.
There is group of two radio buttons (values 'Yes' and 'No') and on selecting
any one of them either a drop down box is displayed or a text box is
displayed.

I want to validate the text box or drop down box based on which radio button
is selected

I have added the following entry in validation.xml:
	<form name="productForm">
		<field property="someStatus" depends="required">
<!-- This is the radio button with two options Yes and No -->
				<arg key="label.status" /> 
		</field>

		<field property="statusText" depends="validwhen">
			<arg position="0" key="label.text.value" />
			<var>
				<var-name>test</var-name>
				<var-value>
					((someStatus != 'Yes') or (*this* != null))
				</var-value>
			</var>
		</field>
	</form>

The javascript validation is not generated for this case.

Similar questions remain unanswered on this mailing list

Thanks
-- 
View this message in context: http://www.nabble.com/S1-1.3.8-Validation-using-%27validwhen%27-for-radio-button-tf4248440.html#a12090493
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S1-1.3.8 Validation using 'validwhen' for radio button

Posted by Paul Benedict <pb...@apache.org>.
I do not believe validwhen generates Javascript validation. It is only on
the server-side.

On 8/10/07, Vivek Chauhan <si...@gmail.com> wrote:
>
>
> Hi,
>
> I am trying to do a conditional validation using 'validwhen'.
> There is group of two radio buttons (values 'Yes' and 'No') and on
> selecting
> any one of them either a drop down box is displayed or a text box is
> displayed.
>
> I want to validate the text box or drop down box based on which radio
> button
> is selected
>
> I have added the following entry in validation.xml:
>         <form name="productForm">
>                 <field property="someStatus" depends="required">
> <!-- This is the radio button with two options Yes and No -->
>                                 <arg key="label.status" />
>                 </field>
>
>                 <field property="statusText" depends="validwhen">
>                         <arg position="0" key="label.text.value" />
>                         <var>
>                                 <var-name>test</var-name>
>                                 <var-value>
>                                         ((someStatus != 'Yes') or (*this*
> != null))
>                                 </var-value>
>                         </var>
>                 </field>
>         </form>
>
> The javascript validation is not generated for this case.
>
> Similar questions remain unanswered on this mailing list
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/S1-1.3.8-Validation-using-%27validwhen%27-for-radio-button-tf4248440.html#a12090493
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>