Search code examples
jsfprimefacescommandbuttondatascroller

Action of p:commandButton inside p:dataScroller only invoked on first button


Inside a p:dataScroller I got a form with an inputTextarea and a commandButton:

<h:form>
    <p:inputTextarea rows="4" cols="15" autoResize="false" value="#{feedBean.comment}" />
    <br />
    <p:commandButton value="Kommentar posten" action="#{feedBean.commentStatus(entry.id)}" />                                               
</h:form>

When I click the first button everything works fine. When I try to click the second or the third button the method is not called. I also tried to use f:param but it doesn't work too.

This is the method commentStatus:

public String commentStatus(String id) {
    /* Irrelevant code */

    System.out.println("###entryId: "+id);

    /* Irrelevant code */

    return NavigationBean.securedFeedLink;
}

EDIT: Just found the solution by myself. I had to add process="@form" to my button. Now it works fine!

EDIT 2: My form was nested into another form that's why I needed process="@form" I updated my code and removed the other form. Now it works without adding process="@form"!


Solution

  • Just found the solution by myself. I had to add process="@form" to my button. Now it works fine!