Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onLeaveStep Event Not firing #108

Open
aman-saggu-git opened this issue Feb 14, 2017 · 3 comments
Open

onLeaveStep Event Not firing #108

aman-saggu-git opened this issue Feb 14, 2017 · 3 comments

Comments

@aman-saggu-git
Copy link

I am using below code everything is working fine but i want to put validation and i used code as per your documentation. but OnLeaveStep event on below code is not even showing alert box
Code -

$('#smartwizard').smartWizard({ 
               labelFinish:'Proceed To Checkout',
               onLeaveStep:  function (obj, context){
                                     alert(obj+context);
               },
               selected: 0, 
               theme: 'arrows',
               transitionEffect:'fade',
               toolbarSettings: {toolbarPosition: 'bottom',
                                     toolbarExtraButtons: [btnFinish],
                            },                                   
                   });
@mikeslim7
Copy link

mikeslim7 commented Feb 21, 2017

I think for it to work you need to return true/false. try like this:
$('#smartwizard').smartWizard({ onLeaveStep: myFunction }); function myFunction(obj, context){ alert(obj+context); return false; }
I have not tested though.

@deathgore
Copy link

They work by with $.on hook:
var smartWizardElement = $('#smartwizard').smartWizard({........});
smartWizardElement .on('leaveStep', callback); --> this works

@Joozty
Copy link

Joozty commented Jun 6, 2018

@deathgore Yes you are right but how can I access context.fromStep and context.toStep variables.

smartWizardElement.on('leaveStep', function(event, context){
    alert("Leaving step " + context.fromStep + " to go to step " + context.toStep);
    // return false to stay on step and true to continue navigation
    return true;
});

This returns undefined:
"Leaving step undefined to go to step undefined"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants