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

onChange fired twice #6

Closed
wrabit opened this issue Aug 24, 2018 · 7 comments
Closed

onChange fired twice #6

wrabit opened this issue Aug 24, 2018 · 7 comments

Comments

@wrabit
Copy link

wrabit commented Aug 24, 2018

For me, with the demo setup and hooking into the onChange event, the 'validate!' alert is showing 2 times when hitting next from step 2.

  <script>
    $('#wizard').steps({
      onFinish: function() {
        alert('yo');
      },
      onChange: function(currentIndex, newIndex, stepDirection) {
        if( stepDirection == 'forward' ) {
          alert('validate!');
        }
        return true;
      }
    });
  </script>
@miloandco
Copy link

Got same issue.

@rpizao
Copy link

rpizao commented Aug 16, 2019

Me too! :(

@niveathika
Copy link

Same here!

@VictorioBerra
Copy link

Same issue here.

@oguzhanoya
Copy link
Owner

I fixed it in the new version.

@VictorioBerra
Copy link

VictorioBerra commented Sep 27, 2020 via email

@JaleesaLLC
Copy link

JaleesaLLC commented Apr 29, 2022

Still firing twice even when I'm using last version (1.1.3)

Update:
Actually I figure out that it was intended to fire twice, and you can filter it upon your need using (currentIndex , newIndex , stepDirection)

Example:

if (currentIndex === newIndex) {
   // do something ....
)

if (currentIndex == '3' && stepDirection == 'forward') {
   // do something ....
)

and so on ...

stepDirection = none | backward | forward

Dear @oguzhanoya I be more than happy to volunteer to update the documentation to provide more information, give me your approval and I'll do it :)

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

7 participants
@VictorioBerra @miloandco @rpizao @wrabit @oguzhanoya @niveathika and others