hide and show on selection of radio button in JSF
843844Feb 20 2008 — edited Feb 20 2008hi
I have a scenario in which i have hide one input type on selection of one radio button and to show the other input type and on selection of the other radio button have to show the hidden one and to hide the displayed one .
am using <h:selectOneRadio>
i have used this javascript
onclick=document.getElementById('text1').style.visibility='hidden';
and
onclick=document.getElementById('text2').style.visibility=' visible' ';
but it is not working ...
this is the code /...
<BODY>
<hx:scriptCollector id="scriptCollector1">
<h:form styleClass="form" id="form1">
<P>Testing SelectPartner</P>
<h:selectOneRadio disabledClass="selectOneRadio_Disabled"
styleClass="selectOneRadio" id="radio1" onclick="organization(this, event);">
<f:selectItem itemValue="#{partnerBean.partnerType}"
itemLabel="Organization" />
</h:selectOneRadio>
<h:selectOneRadio disabledClass="selectOneRadio_Disabled"
styleClass="selectOneRadio" id="radio2">
<f:selectItem itemValue="#{partnerBean.partnerType}"
itemLabel="Person" />
</h:selectOneRadio>
<TABLE>
<TBODY>
<TR>
<TD align="left">Nationality:</TD>
<TD style="width:5px"> </TD>
<TD><h:inputText id="text1" value="#{partnerBean.nationality}"
styleClass="inputText">
</h:inputText></TD>
</TR>
</TBODY>
</TABLE><table>
<tbody>
<tr>
<td align="left">OrganizationName:</td>
<td style="width:5px"> </td>
<td><h:inputText id="text2" value="#{partnerBean.organizationName}" styleClass="inputText" >
</h:inputText>
</td>
</tr>
</tbody>
</table><BR>
<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" action="#{partnerBean.change}" id="button1"></hx:commandExButton>
<BR>
</h:form>
</hx:scriptCollector>
</BODY>
</f:view>
</HTML>
can anybody help.....