diff --git a/components/clientComponents/forms/Form/Form.tsx b/components/clientComponents/forms/Form/Form.tsx index 7f6a62c3e8..e7d487fa49 100644 --- a/components/clientComponents/forms/Form/Form.tsx +++ b/components/clientComponents/forms/Form/Form.tsx @@ -28,7 +28,6 @@ import { import { filterShownElements, filterValuesByShownElements } from "@lib/formContext"; import { formHasGroups } from "@lib/utils/form-builder/formHasGroups"; import { showReviewPage } from "@lib/utils/form-builder/showReviewPage"; -import { t } from "i18next"; interface SubmitButtonProps { numberOfRequiredQuestions: number; @@ -170,7 +169,12 @@ const InnerForm: React.FC = (props) => { const errorList = props.errors ? getErrorList(props) : null; const errorId = "gc-form-errors"; const serverErrorId = `${errorId}-server`; - const formStatusError = props.status === "Error" ? props.errors.form || t("server-error") : null; + const formStatusError = + props.status === "FileError" + ? t("input-validation.file-submission") + : props.status === "Error" + ? t("server-error") + : null; // If there are errors on the page, set focus the first error field useEffect(() => { @@ -391,12 +395,7 @@ export const Form = withFormik({ ); if (result.error) { - formikBag.setStatus("Error"); - if (result.error.message.includes("FileValidationResult")) { - formikBag.setErrors({ - form: t("input-validation.file-submission"), - }); - } + formikBag.setStatus("FileError"); } else { formikBag.props.onSuccess(result.id); }