diff --git a/site/gatsby-site/src/components/forms/SubmissionWizard/StepOne.js b/site/gatsby-site/src/components/forms/SubmissionWizard/StepOne.js index 97c8dd0cda..f7dbec8b68 100644 --- a/site/gatsby-site/src/components/forms/SubmissionWizard/StepOne.js +++ b/site/gatsby-site/src/components/forms/SubmissionWizard/StepOne.js @@ -99,6 +99,7 @@ const StepOne = (props) => { submissionReset={props.submissionReset} urlFromQueryString={props.urlFromQueryString} setSavingInLocalStorage={props.setSavingInLocalStorage} + returning={props.returning} /> @@ -116,6 +117,7 @@ const FormDetails = ({ submissionReset, urlFromQueryString, setSavingInLocalStorage, + returning, }) => { const { t } = useTranslation(['submit']); @@ -172,6 +174,16 @@ const FormDetails = ({ } }, [urlFromQueryString]); + useEffect(() => { + if (returning) { + validateForm().then((invalidFields) => { + Object.keys(invalidFields).map((key) => { + setFieldTouched(key, true); + }); + }); + } + }, [returning]); + const fetchNews = async (url) => { await parseNewsUrl(url); Object.keys(errors).map((key) => { diff --git a/site/gatsby-site/src/components/forms/SubmissionWizard/StepThree.js b/site/gatsby-site/src/components/forms/SubmissionWizard/StepThree.js index 599fdfc311..f5d88f760a 100644 --- a/site/gatsby-site/src/components/forms/SubmissionWizard/StepThree.js +++ b/site/gatsby-site/src/components/forms/SubmissionWizard/StepThree.js @@ -199,6 +199,7 @@ const StepThree = (props) => { setSavingInLocalStorage={props.setSavingInLocalStorage} submissionComplete={props.submissionComplete} submissionReset={props.submissionReset} + returning={props.returning} /> @@ -216,6 +217,7 @@ const FormDetails = ({ submissionReset, entityNames, setSavingInLocalStorage, + returning, }) => { const { t } = useTranslation(['submit']); @@ -293,6 +295,16 @@ const FormDetails = ({ saveInLocalStorage(values); }, [values]); + useEffect(() => { + if (returning) { + validateForm().then((invalidFields) => { + Object.keys(invalidFields).map((key) => { + setFieldTouched(key, true); + }); + }); + } + }, [returning]); + return ( <>