diff --git a/src/@episerver/forms-react/src/components/FormBody.tsx b/src/@episerver/forms-react/src/components/FormBody.tsx index cb3f271..8817be3 100644 --- a/src/@episerver/forms-react/src/components/FormBody.tsx +++ b/src/@episerver/forms-react/src/components/FormBody.tsx @@ -27,6 +27,8 @@ export const FormBody = (props: FormBodyProps) => { const formTitleId = `${form.key}_label`; const statusMessage = useRef(""); const statusDisplay = useRef("hide"); + + const showForm = useRef(true); const formCache = new FormCache(); const localFormCache = new FormCache(window.localStorage); @@ -140,10 +142,14 @@ export const FormBody = (props: FormBodyProps) => { dispatchFunctions.updateSubmissionKey(response.submissionKey); localFormCache.set(submissionStorageKey, response.submissionKey); + if (isProgressiveSubmit.current) { + message.current = response.messages.map(m => m.message).join("
"); + showForm.current = false + } + if (isFormFinalized.current) { formCache.remove(FormConstants.FormCurrentStep + form.key); localFormCache.remove(submissionStorageKey); - message.current = response.messages.map(m => m.message).join("
"); //redirect after submit let redirectToPage = submitButton?.properties?.redirectToPage ?? form.properties?.redirectToPage; if (!isNullOrEmpty(redirectToPage)) { @@ -234,7 +240,7 @@ export const FormBody = (props: FormBodyProps) => { -
+
{/* render element */} {form.steps.map((e, i) => { let stepDisplaying = (currentStepIndex === i && !isFormFinalized.current && isStepValidToDisplay && !isMalFormSteps) ? "" : "hide";