jsf - render based on h:selectOneMenu value -


this question has answer here:

i want display div layers based on h:selectonemenu selected value. cr

eated code:      <h:selectonemenu id="zone" value="#{download.zone}" style="width: 212px;">         <f:selectitem id="select" itemlabel="select download mirror" itemvalue="select download mirror" />         <f:selectitem id="usa" itemlabel="usa" itemvalue="usa" />         <f:selectitem id="canada" itemlabel="canada" itemvalue="canada" />     </h:selectonemenu>  ...  private string zone;      public string getzone()     {         return zone;     }      public void setzone(string zone)     {         this.zone = zone;     } 

this div layer want display based on value:

<div id="usa_release_server" style="padding-top: 20px;" class="text" rendered="#{download.zone == 'usa'}">                                 <h6>usa release server</h6> </div> 

but when select value in h:selectonemenu nothing happens. have idea i'm missing?

rendered not valid html attribute, has used on jsf tags. here can use <h:panelgroup> component layout="block" render <div>, , add ajax component update on <h:selectonemenu> change:

<h:form>     <h:panelgroup layout="block" id="usa_release_server"         style="padding-top: 20px;" styleclass="text"         rendered="#{download.zone eq 'usa'}">         <h6>usa release server</h6>     </h:panelgroup>     <h:selectonemenu id="zone" value="#{download.zone}"         style="width: 212px;">         <f:selectitem id="select" itemlabel="select download mirror"             itemvalue="select download mirror" />         <f:selectitem id="usa" itemlabel="usa" itemvalue="usa" />         <f:selectitem id="canada" itemlabel="canada" itemvalue="canada" />         <f:ajax event="change" render="@form" />     </h:selectonemenu> </h:form> 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -