You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Prabhubalaji Ragavan <pr...@gmail.com> on 2010/11/15 11:44:50 UTC
Validation xml for Radio button
Hi
I am using a radio option in my code. when i try to validate that thru the
validator.xml, the validation is not happening.
this is my jsp content.
<s:radio label="Answer" name="yourAnswer" list="#{'1':'Yes','2':'No'}" />
this is my validator.xml content
<field name="yourAnswer">
<field-validator type="fieldexpression">
<param name="expression"><![CDATA[(yourAnswer == "1")]]></param>
<message>enter gen1</message>
</field-validator>
</field>
Please help, am new to struts2.
Thanks
Prabhu Ragavan
Re: Validation xml for Radio button
Posted by Li Ying <li...@gmail.com>.
What data type of the property [yourAnswer] is ?
If it is an int property, try delete the double-quotation surrounding
the value 1.
2010/11/15 Prabhubalaji Ragavan <pr...@gmail.com>:
> Hi
> I am using a radio option in my code. when i try to validate that thru the
> validator.xml, the validation is not happening.
>
> this is my jsp content.
>
> <s:radio label="Answer" name="yourAnswer" list="#{'1':'Yes','2':'No'}" />
>
> this is my validator.xml content
>
> <field name="yourAnswer">
> <field-validator type="fieldexpression">
> <param name="expression"><![CDATA[(yourAnswer == "1")]]></param>
> <message>enter gen1</message>
> </field-validator>
> </field>
>
>
> Please help, am new to struts2.
>
> Thanks
> Prabhu Ragavan
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org