This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Dynamically visibility control in JSF using selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamically visibility control in JSF using selectOneMenu" Watch "Dynamically visibility control in JSF using selectOneMenu" New topic
Author

Dynamically visibility control in JSF using selectOneMenu

Debajyoti Kundu
Greenhorn

Joined: Sep 14, 2011
Posts: 23
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
Debajyoti Kundu
Greenhorn

Joined: Sep 14, 2011
Posts: 23
Found the error.. It's working now
 
jQuery in Action, 2nd edition
 
subject: Dynamically visibility control in JSF using selectOneMenu
 
Similar Threads
SelectOneMenu Validation
javax.xml.rpc.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException:
To open JSF web page in new window for selected options
Setting default value to h: selectOneMenu on button click
Richface/Primefaces Elements are not rendered