Go to first wizard tab after submit

UI Components for JSF
Post Reply
catdog
Posts: 2
Joined: 28 Sep 2011, 18:45

28 Sep 2011, 18:51

Hello! I have a need to navigate to the first tab of the wizard component after submit button on the last tab is pressed. Saw this topic viewtopic.php?f=3&t=14786&p=45048&hilit ... tab#p45048 but don't understand it. Submit button is not like next one, it doesn't file any FlowEvent :( Or there is a way to pass such event? Thanks for help in advance!!

arturo
Posts: 90
Joined: 23 Aug 2011, 09:57
Location: Mexico

28 Sep 2011, 21:11

You could do it with javascript:

Use the widgetVar attribute, this will be used in javascript:

Code: Select all

 <p:wizard widgetVar="wiz" ...> 
Asumming that you want to reset the wizard after a commandButton action:

Code: Select all

<p:commandButton .... oncomplete="resetWizard()"/>
The javascript code:

Code: Select all

         <script type="text/javascript">  
                    function resetWizard() {
                        wiz.loadStep(wiz.cfg.steps[0], true);
                    }
         </script>
If you dont want to write a javascript function, then you could do it this way:

Code: Select all

<p:commandButton .... oncomplete="wiz.loadStep(wiz.cfg.steps[0], true)"/>
PrimeFaces 4.0 | Extensions 1.1.0 | GlassFish 4.0 | Mojarra 2.2.4 | NetBeans 7.3.1

catdog
Posts: 2
Joined: 28 Sep 2011, 18:45

29 Sep 2011, 12:38

arturo, thank you very much! that worked great!
:idea: IMHO this solution should be shown in showcase or/and in the book. :idea:

sergiool
Posts: 13
Joined: 29 Mar 2012, 11:28
Location: Cd. Sahagún; Hidalgo. México

29 Mar 2012, 11:32

It also works in version 2.2.1?
Primefaces 5.1
Mojarra 2.2.9
Glassfish 3.1.2
Wildfly 8.1
Ubuntu 14
Netbeans 8.0.1

sergiool
Posts: 13
Joined: 29 Mar 2012, 11:28
Location: Cd. Sahagún; Hidalgo. México

29 Mar 2012, 11:37

I'm trying to reset a component wizard dialog inside but I can not do it. Even using onComplete = "wiz.loadStep (wiz.cfg.steps [0], true)" in my command button. Any help? :?:
Primefaces 5.1
Mojarra 2.2.9
Glassfish 3.1.2
Wildfly 8.1
Ubuntu 14
Netbeans 8.0.1

sergiool
Posts: 13
Joined: 29 Mar 2012, 11:28
Location: Cd. Sahagún; Hidalgo. México

29 Mar 2012, 11:37

I'm trying to reset a component wizard dialog inside but I can not do it. Even using onComplete = "wiz.loadStep (wiz.cfg.steps [0], true)" in my command button. Any help?
Primefaces 5.1
Mojarra 2.2.9
Glassfish 3.1.2
Wildfly 8.1
Ubuntu 14
Netbeans 8.0.1

ahoehn
Posts: 25
Joined: 04 Feb 2011, 14:27

27 Jun 2012, 13:42

if I try this solution my wizard jumps allways to the second step. It doesn't matter if i use
wiz.loadStep (wiz.cfg.steps [0], true);
or
wiz.loadStep (wiz.cfg.steps [1], true);

it's even bader:
If I execute wiz.loadStep (wiz.cfg.steps [0], true) twice the wizard jumps from one wizard step to the other. Same thing i I use the id of the tab wiz.loadStep ('company', true); So it seams to me that this must be a primefaces bug in the javascript. (Of course the tab-id company just exists once)

Any other ideas why?

I use primeface 3.3.1

Edit:
it works only when I add the following:
if(wizard.currentStep != "company"){
wiz.loadStep ('company', true);
}

if I execute wiz.loadStep ('company', true) when the wizard is allready in this step, the wizard jumps to a different location.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests