jquery - show hide inputTextarea on click of a commandLink in jsf -


on click of commandlink, inputtextarea should appear/render. here code trying -

<h:form id="myform"> <p:commandlink id="onuselink" style="text-align: right; vertical-align: bottom;">  <p:ajax event="click" render=":myform:onuse" ></p:ajax>  <h:graphicimage styleclass="rollover imgaligntop" style="border:none;" name="plus.gif" library ="images"/> </p:commandlink>  <p:inputtextarea id="onuse" size="15"></p:inputtextarea> </h:form> 

somebody please help.

you don't need p:ajax update component.
there update attribute on command button itself.
usual way accomplish scenario put textarea in panelgroup.
update panel group & apply rendered components.

and don't need refer components id attached form id [formid:componentid] when its in same form.

try :

togglebean.java

import javax.faces.bean.managedbean; import javax.faces.bean.sessionscoped;  @managedbean @viewscoped public class togglebean implements serializable {      private boolean renderer=false;      public boolean isrenderer() {         return renderer;     }      public void setrenderer(boolean renderer) {         this.renderer = renderer;     }      public void buttonaction(){         renderer = !(renderer);     }  } 

xhtml page:

<h:form id="myform">             <p:commandlink id="onuselink" style="text-align: right; vertical-align: bottom;" action="#{togglebean.buttonaction}" value="click" update="usepanelgroup">                 <h:graphicimage styleclass="rollover imgaligntop" style="border:none;" name="plus.gif" library ="images"/>              </p:commandlink>              <h:panelgroup id="usepanelgroup">                 <p:inputtextarea id="onuse" size="15" rendered="#{togglebean.renderer}" ></p:inputtextarea>             </h:panelgroup>          </h:form> 

good luck.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -