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

Enter key goes back instead of forward #12

Open
smeijer opened this issue Sep 5, 2014 · 3 comments
Open

Enter key goes back instead of forward #12

smeijer opened this issue Sep 5, 2014 · 3 comments

Comments

@smeijer
Copy link

smeijer commented Sep 5, 2014

I expect to go to the next step when hitting Enter. But instead the wizard will bring you back to the previous page. Seems like a bug?

@st3ph
Copy link
Owner

st3ph commented Sep 5, 2014

Kinda weird, hitting enter submit the form and if you have error it show you the step with it

@smeijer
Copy link
Author

smeijer commented Sep 5, 2014

The last step is working like you describe. It submits, and returns the wizard to the step with the error. But the steps before the last aren't always. I've tested in chrome and internet explorer. It seems that the "back button" somehow takes focus.

My current work around:

$('#myform').easyWizard();

$('#myform').keypress(function(e) {
    if(e.which !== 13)
        return;

    e.preventDefault();

    var isLast = $(this).find('.easyWizardSteps li:last')[0].classList.contains('current');
    var action = isLast ? 'submit' : 'next';
    $(this).find('button.' + action).click();
});

@st3ph
Copy link
Owner

st3ph commented Sep 5, 2014

Ok I see (sorry, lonnng time without working on this plugin), if it's the last step it submit the form, if not it goes to the next step.
If you go to the previous step it's like the "previous button" have the class "next"...

I don't have the time to test and debug it this week end but I will try to find some next week

Thank you for the report

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

2 participants