posted 9 years ago
Hi,
I'm trying to implement a functionality which will control the visibility of three outputText. I'm using a selectOneMenu, which has three options. Each option will enable visibility of one outputText, and rest will be invisible.
I used the following code
<h:selectOneMenu id="search" styleClass="select-box" value="#{empMB.showHide}" required="true" requiredMessage="Please Select an Option" >
<f:selectItem itemLabel="-----Select----"/>
<f:selectItem itemLabel="By Name" itemValue="1"/>
<f:selectItem itemLabel="By Id" itemValue="2"/>
<f:selectItem itemLabel="By Phone No" itemValue="3"/>
</h:selectOneMenu>
<h:outputText rendered="#{empMB.showHide ==1 }" value="Hello 1"></h:outputText>
<h:outputText rendered="#{empMB.showHide ==2 }" value="Hello 2"></h:outputText>
<h:outputText rendered="#{empMB.showHide ==3 }" value="Hello 3"></h:outputText>
Initially all outputText s is invisible as rendered value is false, but when I select different options, their respective outputText s are not visible.
Can anyone help me with this?
Thanks & Regards,
Debajyoti Kundu