Weasemunk
Weasemunk

Reputation: 455

How to Perform a Javascript function using Primefaces wizard onnext attribute?

I am using PrimeFaces 5.3 and eventually want to use the onnext attribute of the wizard to hide the Next button using hideNextNav(). However, I am currently just trying to test this functionality by calling the next() method instead. Since I am new to primefaces and jsf in general, I have attempted using various syntax, but all my attempts have rendered the Next button non-functional. When I try alert() instead, it works correctly, showing a message box and proceeding to the next tab.

My error:

jsf error

My xhtml code:

<script>
    function nextf(){
        PF('wizard').next();
    }
</script>
...
<p:wizard widgetVar="wizard" flowListener="#{editController.onFlowProcess}" onnext="nextf();">

Your help would be greatly appreciated.

Upvotes: 1

Views: 753

Answers (1)

BalusC
BalusC

Reputation: 1108722

Opening the next tab triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. The onnext event function in turn triggers PF('wizard').next() call. The PF('wizard').next() in turn triggers the onnext event. Etcetera.

And then maximum call stack size was exceeded.

You'd better not call PF('wizard').next() during the onnext event.

Upvotes: 5

Related Questions