How to redirect primefaces wizard to first tab after submit on last tab

In primefaces 5 you can't call widgetVar directly, you need to call it like PF('widgetVar') so you can do it like this :

<p:commandButton value="Submit" actionListener="#{userWizard.save}" oncomplete="PF('wiz').loadStep('tabId',false)" />

In the wizard.xhtml page change your submit button to :

<p:commandButton immediate="true" value="Submit" update="@parent,:form:userList" actionListener="#{userWizard.save}" oncomplete="wiz.loadStep (wiz.cfg.steps [0], true)"/>

you can also do it from Java code as follow:

Wizard wizard = (Wizard) FacesContext.getCurrentInstance().getViewRoot().findComponent("importForm:wizardId");
wizard.setStep(STEP1);
RequestContext.getCurrentInstance().update("importForm");

Tags:

Primefaces