0

I have a p:commandButton with an action attribute assigned located in a p:panelGroup which is conditionally rendered. The action method is not fired if I'm pressing the button.

If I remove the rendered attribute of the surrounding p:panelGroup (so it's always rendered) the action method is called. I don't want to assign a rendered attribute to every single element inside my form - I just want to show/hide the whole p:panelGroup. Is this possible? If yes, what can I do to get it working?

<h:panelGroup id="neues-verfahren-panelgroup" rendered="#{verfahrenTree.currentType.equals('neues-verfahren')}"
    styleClass="form-container">

    <h:form id="form-neues-verfahren">

        <!-- form data goes here ... -->

        <div class="form-row">
            <p:commandButton id="form-neues-verfahren-speichern" action="#{verfahrenBean.neuesVerfahrenSpeichern}" value="Speichern" />
        </div>

    </h:form>

</h:panelGroup>

Edit (Solved): Changing the scope of the backing bean from request scoped to view scoped solved the problem.

baumlol
  • 85
  • 1
  • 8
  • Tried moving the form so it wraps the panel? D please post jsf and PF version – Kukeltje Dec 01 '16 at 08:14
  • If the form wraps the panel I get a ComponentNotFoundException. What do you mean with JSF and PF version? – baumlol Dec 01 '16 at 08:24
  • Then correct the update references... – Kukeltje Dec 01 '16 at 08:26
  • There is nothing to update. The IDs haven't changed. – baumlol Dec 01 '16 at 08:31
  • Then your exception cannot be explained by the code you show (at least not by me)... [mcve] please. And post **what** component cannot be found – Kukeltje Dec 01 '16 at 08:32
  • Check #9 here: https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value – Kukeltje Dec 01 '16 at 08:35
  • You were right - there was an update reference I needed to remove. Now the exception is gone and the form wraps the panelGroup. Followed #9 of your link and added `` to my p:commandButton. Now the form is submitted two times but the action method still not gets executed. – baumlol Dec 01 '16 at 08:50

0 Answers0