Skip to content

Commit d5a1168

Browse files
fix validation quirk
1 parent 1d013c0 commit d5a1168

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/plugin/VStepperForm.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,25 @@ function removePageError(pageIndex: number): void {
531531
currentPageHasErrors.value = false;
532532
}
533533
534+
// Reset the next page fields //
535+
const resetPageFields = (pageIndex: number) => {
536+
const page = computedPages.value[pageIndex + 1];
537+
538+
if (!page) {
539+
return;
540+
}
541+
542+
if (!page?.fields?.length) {
543+
return;
544+
}
545+
546+
for (const field of page.fields) {
547+
if (field.name) {
548+
$useForm.resetField(field.name, { force: true });
549+
}
550+
}
551+
};
552+
534553
// ------------------------ Check the if the page has errors //
535554
function checkForPageErrors(errors: ValidateResult['errors'], source: string, next = () => { }): void {
536555
const page = computedPages.value[currentPageIdx.value];
@@ -553,6 +572,7 @@ function checkForPageErrors(errors: ValidateResult['errors'], source: string, ne
553572
removePageError(pageIndex);
554573
555574
if (next && !lastPage.value && source !== 'submit') {
575+
resetPageFields(pageIndex);
556576
next();
557577
}
558578
}

0 commit comments

Comments
 (0)