• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating radio buttons using validator or validation-ruls.xml

 
vamshidhar nimbagiri
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I got radio buttons in my JSP, here i need to show a error message if the user didn't select none of the
radio buttons (condition is: if the enteredFlag="Y" then all radio buttons must be selected else not
required). Here we need to use validation.xml or validator-rules.xml for all validations.But the
problem is here i got a "xesp" which is declared as Obect array in struts-config.xml,
each object[i] will show what the user selected.
1. how to show the message according to the condtion.
2. its showing the 9 messages if user didn't select 9 options.(it should show only message saying all must be selected)

here is my jsp example:
<tr>
<td nowrap>
<html:radio name="xxForm" property="xesp[0].xSw" value="Y" /> Yes</td>
<td nowrap>
<html:radio name="xxForm" property="xesp[0].xSw" value="N" /> No</td>
</tr>
<tr>
<td nowrap>
<html:radio name="xxForm" property="xesp[1].xSw" value="Y" /> Yes</td>
<td nowrap>
<html:radio name="xxForm" property="xesp[1].xSw" value="N" /> No</td>
</tr>
.
.
.
.
.till 9..

in validation.xml:
<!-- Every question must be answered, else set error -->
<form name="xForm">
<field property="xResp[0].xSw" depends="required">
<msg name="required" key="xp.xh.xns.required"/>
</field>
<field property="xesp[1].xSw" depends="required">
<msg name="required" key="xp.xh.xns.required"/>
</field>
..
..
.
.
.till 9


Thanks!!
vamshi
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic