jsf - Can we create textbox right next to selectonemenu component when we fire selectoneMenu valueChangeListener event -


want create textbox on fly possible?
select report run:

<h:selectonemenu value="#{reportbean.selectreport}">     <f:selectitems value = "#{reportbean.allreports}" />     <f:ajax listener="#{reportbean.getreqid}" render="reqid"> </f:ajax> </h:selectonemenu> 

seems want show/hide <h:inputtext> based on selected value on <h:selectonemenu>. yes, can achieved plain jsf.

note if use set rendered attribute false component won't appear in component tree, there no way can't referenced call (not ajax calls). in order update it, should wrap component inside component <h:panelgroup> , render wrapper. basic example:

<h:form id="frmrep">     <h:selectonemenu value="#{reportbean.selectreport}">         <f:selectitems value = "#{reportbean.allreports}" />         <!--           assuming reportbean.getreqid method change value of           reportbean.showreqid attribute render/not render , works         -->         <f:ajax listener="#{reportbean.getreqid}" render="pnlrepname" />     </h:selectonemenu>     <h:panelgroup id="pnlrepname">         <h:inputtext id="reqid" rendered="#{reportbean.showreqid}"             value="#{reportbean.reportname}" />     <h:panelgroup> </h:form> 

for specific requirement instead, won't recommend using ajax call since has go server check if component should or should not showed user. opt javascript solution handle on client side.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -