Romelou Striga
Romelou Striga

Reputation: 96

JSF commandbutton not being called when adding primefaces ajax

I am facing an issue when trying to add javascript function to be called after the command button is called but I am only getting the javascript fuction "forGo()" being called but not the function register located in the managed bean when I remove the p:ajax code the function is executed succesfully but I need the forGo function to be executed too, I wrote this code two years ago and it was working fine, any advice would help, thanks.

<p:commandButton value="Register" actionListener="#{ClientMB.Register()}" >
                                            <p:ajax event="click" oncomplete="forGo()"></p:ajax>
                                            </p:commandButton></h:form>

Upvotes: 1

Views: 43

Answers (1)

sparrow.
sparrow.

Reputation: 101

I would suggest to remove the <p:ajax> and just use the <p:commandButton> oncomplete attribute directly:

<p:commandButton value="Register" actionListener="#{ClientMB.Register()}" oncomplete="forGo()" />

Upvotes: 4

Related Questions