I am trying to develop a web page.In the webpage, i have two radio button. I need to make visible some text fields and labels when one radio button is selected and make other fields invisible. Here is what i have coded
<tr>
<td width="10%"> </td>
<td width="10%" colspan="2" align="center">
<html:radio property="regradio" VALUE="viamob"/>
Register via mobile number</td>
</tr>
<tr>
<td width="10%" colspan="2" align="center">
<html:radio property="regradio" VALUE="viaAA" />
Register via AA System number </td>
</tr>
<tr>
<tr>
<td width="10%"> </td> <td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username" /></font></td>
<td width="10%">
<html:text property='newusername' style="display" /></td>
<td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username"/></font></td>
<td width="10%">
<html:text property='newusername' style="display" /></td>
</tr>
<tr>
<td width="10%"> </td> <td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.mobileno"/></font></td>
<td width="10%">
<html:text property='newmobno' /></td>
<td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.emailid"/></font></td>
<td width="10%">
<html:text property='emailId' /></td>
</tr>
<tr>
<html:button property='go' value="Go" onClick="javascript:fnCheck(this.form)"/>
</tr>
Here is the script part.
<Script language='Javascript'>
function fnCheck(frm)
{
if(frm.regradio.value=="viaAA")
{
frm.newusername.style.display="none";
}
if(frm.regradio.value=="viamob")
{
frm.newusername.style.display="block";
}
}
</script>
But no field is getting visible/invisible when the selection of radio button is different. Please help. I have searched in net , but didnt yield any result
<tr>
<td width="10%"> </td>
<td width="10%" colspan="2" align="center">
<html:radio property="regradio" VALUE="viamob"/>
Register via mobile number</td>
</tr>
<tr>
<td width="10%" colspan="2" align="center">
<html:radio property="regradio" VALUE="viaAA" />
Register via AA System number </td>
</tr>
<tr>
<tr>
<td width="10%"> </td> <td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username" /></font></td>
<td width="10%">
<html:text property='newusername' style="display" /></td>
<td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username"/></font></td>
<td width="10%">
<html:text property='newusername' style="display" /></td>
</tr>
<tr>
<td width="10%"> </td> <td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.mobileno"/></font></td>
<td width="10%">
<html:text property='newmobno' /></td>
<td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.emailid"/></font></td>
<td width="10%">
<html:text property='emailId' /></td>
</tr>
<tr>
<html:button property='go' value="Go" onClick="javascript:fnCheck(this.form)"/>
</tr>
Here is the script part.
<Script language='Javascript'>
function fnCheck(frm)
{
if(frm.regradio.value=="viaAA")
{
frm.newusername.style.display="none";
}
if(frm.regradio.value=="viamob")
{
frm.newusername.style.display="block";
}
}
</script>
But no field is getting visible/invisible when the selection of radio button is different. Please help. I have searched in net , but didnt yield any result