1

I want to show a form in the layoutUnit center when I click in the p:commandButton in the left side using rendered, I tried with this code but It didn't work:

test.xhtml

<h:body>
    <p:layout fullPage="true" >
        <p:layoutUnit position="west" size="175" header="Tableau de bord">
            <h:form>
                <p:commandButton  actionListener="#{userBean.formClient}" value="Client" />
            </h:form> 
        </p:layoutUnit>
        <p:layoutUnit position="center" >
            <p:panel id="panelClient" rendered="#{userBean.showFormClt}">
                <h1>Testing</h1>
            </p:panel>
        </p:layoutUnit>
    </p:layout>
</h:body>

UserBean.java

private boolean showFormClt;

 public boolean isShowFormClt() {
    return showFormClt;
}

public void setShowFormClt(boolean showFormClt) {
    this.showFormClt = showFormClt;
}

public void formClient(ActionEvent e){
   showFormClt = true;
}
YCF_L
  • 51,266
  • 13
  • 85
  • 129
mak_doni
  • 533
  • 1
  • 8
  • 24

1 Answers1

-1

You can just use ajax="false" :

<p:commandButton actionListener="#{userBean.formClient}" 
                 value="Client" ajax="false"/>
YCF_L
  • 51,266
  • 13
  • 85
  • 129
  • @mak_doni try with `ajax="false"` i edit my answer hope that help you – YCF_L Dec 16 '17 at 17:42
  • Bad suggestion... a form around the layout is a 'god form' and prome to result in errors. And it should work with ajax too...and update is useless when not doing ajax – Kukeltje Dec 16 '17 at 18:24
  • you are right @Kukeltje i mixed many information, i arrive to make it work just with `ajax="false"` i can't make it work with `update` can you share a solution using update, and you have my up-vote? – YCF_L Dec 16 '17 at 19:03
  • Start reading https://stackoverflow.com/questions/8634156/how-to-find-out-client-id-of-component-for-ajax-update-render-cannot-find-compo and make sure if things do not work to always run in development mode and have messages component in your page that is updated (best via autoupdate) – Kukeltje Dec 16 '17 at 20:06