@formio/js 5.0.0-dev.5920.f1002ff → 5.0.0-dev.5922.87eeb2f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.form.js +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +1 -1
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Wizard.js +11 -9
- package/lib/mjs/Wizard.js +11 -9
- package/package.json +1 -1
package/lib/cjs/Wizard.js
CHANGED
|
@@ -602,7 +602,10 @@ class Wizard extends Webform_1.default {
|
|
|
602
602
|
}
|
|
603
603
|
this.redraw().then(() => {
|
|
604
604
|
this.checkData(this.submission.data);
|
|
605
|
-
this.validateCurrentPage();
|
|
605
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
606
|
+
if (this.alert) {
|
|
607
|
+
this.showErrors(errors, true, true);
|
|
608
|
+
}
|
|
606
609
|
});
|
|
607
610
|
return Promise.resolve();
|
|
608
611
|
}
|
|
@@ -699,9 +702,11 @@ class Wizard extends Webform_1.default {
|
|
|
699
702
|
});
|
|
700
703
|
});
|
|
701
704
|
}
|
|
702
|
-
// Validate the form
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
+
// Validate the form before going to the next page
|
|
706
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
|
707
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
|
708
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
|
709
|
+
if (currentPageErrors.length === 0) {
|
|
705
710
|
this.checkData(this.submission.data);
|
|
706
711
|
return this.beforePage(true).then(() => {
|
|
707
712
|
return this.setPage(this.getNextPage()).then(() => {
|
|
@@ -716,7 +721,7 @@ class Wizard extends Webform_1.default {
|
|
|
716
721
|
else {
|
|
717
722
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
|
718
723
|
this.scrollIntoView(this.element, true);
|
|
719
|
-
return Promise.reject(
|
|
724
|
+
return Promise.reject(this.showErrors(errors, true));
|
|
720
725
|
}
|
|
721
726
|
}
|
|
722
727
|
validateCurrentPage(flags = {}) {
|
|
@@ -921,10 +926,7 @@ class Wizard extends Webform_1.default {
|
|
|
921
926
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
922
927
|
}
|
|
923
928
|
get errors() {
|
|
924
|
-
|
|
925
|
-
return this.currentPage.errors;
|
|
926
|
-
}
|
|
927
|
-
return super.errors;
|
|
929
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
|
928
930
|
}
|
|
929
931
|
focusOnComponent(key) {
|
|
930
932
|
const component = this.getComponent(key);
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -594,7 +594,10 @@ export default class Wizard extends Webform {
|
|
|
594
594
|
}
|
|
595
595
|
this.redraw().then(() => {
|
|
596
596
|
this.checkData(this.submission.data);
|
|
597
|
-
this.validateCurrentPage();
|
|
597
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
598
|
+
if (this.alert) {
|
|
599
|
+
this.showErrors(errors, true, true);
|
|
600
|
+
}
|
|
598
601
|
});
|
|
599
602
|
return Promise.resolve();
|
|
600
603
|
}
|
|
@@ -689,9 +692,11 @@ export default class Wizard extends Webform {
|
|
|
689
692
|
});
|
|
690
693
|
});
|
|
691
694
|
}
|
|
692
|
-
// Validate the form
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
+
// Validate the form before going to the next page
|
|
696
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
|
697
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
|
698
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
|
699
|
+
if (currentPageErrors.length === 0) {
|
|
695
700
|
this.checkData(this.submission.data);
|
|
696
701
|
return this.beforePage(true).then(() => {
|
|
697
702
|
return this.setPage(this.getNextPage()).then(() => {
|
|
@@ -706,7 +711,7 @@ export default class Wizard extends Webform {
|
|
|
706
711
|
else {
|
|
707
712
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
|
708
713
|
this.scrollIntoView(this.element, true);
|
|
709
|
-
return Promise.reject(
|
|
714
|
+
return Promise.reject(this.showErrors(errors, true));
|
|
710
715
|
}
|
|
711
716
|
}
|
|
712
717
|
validateCurrentPage(flags = {}) {
|
|
@@ -908,10 +913,7 @@ export default class Wizard extends Webform {
|
|
|
908
913
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
909
914
|
}
|
|
910
915
|
get errors() {
|
|
911
|
-
|
|
912
|
-
return this.currentPage.errors;
|
|
913
|
-
}
|
|
914
|
-
return super.errors;
|
|
916
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
|
915
917
|
}
|
|
916
918
|
focusOnComponent(key) {
|
|
917
919
|
const component = this.getComponent(key);
|