Skip to content

Commit

Permalink
fixed bug for edit mode skipping to last step on clicking next.
Browse files Browse the repository at this point in the history
  • Loading branch information
buttflattery committed Jan 26, 2020
1 parent 6d175db commit fb094be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/assets/js/formwizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ $.formwizard = {
},
formValidation: {
run: function (form, event) {

$.formwizard.resetCurrentTarget = false;
$.formwizard.currentButtonTarget = event.target;
$(form).yiiActiveForm("validate", true);
Expand Down Expand Up @@ -304,7 +303,6 @@ $.formwizard = {
}

});

//if skippable step and all the inputs are empty then
//remove all the fields of the step from the validation
if (isSkippableStep && allEmpty) {
Expand Down Expand Up @@ -364,9 +362,10 @@ $.formwizard = {
let wizardContainerId = $.formwizard.options[formName].wizardContainerId;
$("#" + wizardContainerId).smartWizard('updateErrorStep', errorSteps);

//if no error steps then slear errors
//if no error steps then clear errors
if (errorSteps.length) {
$.formwizard.formNavigation.goToStep("#"+wizardContainerId, errorSteps[0]);
return;
}
}

Expand All @@ -381,7 +380,6 @@ $.formwizard = {

//check if target null dont call the next navigation
if ($.formwizard.currentButtonTarget !== null) {

$.formwizard.formNavigation.next(
$.formwizard.currentButtonTarget
);
Expand All @@ -393,11 +391,9 @@ $.formwizard = {
return false;
})
.on("beforeSubmit", function (event) {
console.log('submit');
event.preventDefault();
if ($.formwizard.submit) {
$.formwizard.persistence.clearStorage();
console.log("returning");
return true;
}
return false;
Expand Down Expand Up @@ -435,6 +431,7 @@ $.formwizard = {
.parent()
.closest(".sw-main")
.attr("id");
console.log("next");
$("#" + containerId).smartWizard("next");
},
goToStep: (wizardContainerId, stepno) => {
Expand Down
Loading

0 comments on commit fb094be

Please sign in to comment.