thecodemine / formwizard

jQuery plugin based on top of jQuery UI which turns a form into a multistep wizard. Integrates with the jQuery form plugin for AJAX submission of the form, the validation plugin for client side validation and the BBQ plugin for enabling the browsers back and forward buttons.
140 stars 54 forks source link

Next doesn't work right if sibling elements are present that do not match ".step" #50

Open rinogo opened 6 years ago

rinogo commented 6 years ago

Not enough time to make a proper PR, but I'll post this here in case it helps anyone.

I'm hiding steps in my backend code by changing the class on a step from .step to .hidden-step. This works great, but navigating with the "Next" button causes the plugin to attempt to show our .hidden-step element instead of skipping it and showing the next .step element.

Here's the fix. Make the change to the _navigate() function:

// var step1 =  this.steps.filter("#" + step).next().attr("id"); //Original, gets next sibling (regardless of what it is!).
var step1 =  this.steps.filter("#" + step).nextAll(".step").first().attr("id"); //Fixed by rinogo, 11/27/17, gets next ".step"
husnain-aslam commented 5 years ago

Update jQuery Validation and jQuery UI to latest versions.