Smart Wizard needs to stay on selected step if validation fails

2.9k Views Asked by At

I am using Smart Wizard, and I need to know if it can stay on the selected step if the page validation fails.

At the moment it is flagging the step red, but I need to prevent it from going to the next step until the validation errors are cleared.

Thanks

2

There are 2 best solutions below

0
On

Ok, it seems one of my functions did not return the correct value. I also added the following code to force it back the selected step: $('#wizard').smartWizard('selected', '0');

0
On

you have to return false in the leaveStep function in order to stop it from advancing to the next step

leaveStep = function(from, to) {
    //do nothing
    if(/* validation fails */)
        return false;
    else
        return true;
}