diff --git a/src/Components/HouseholdDataBlock/HouseholdDataBlock.js b/src/Components/HouseholdDataBlock/HouseholdDataBlock.js index 9d3c4d43d..a2e35feb4 100644 --- a/src/Components/HouseholdDataBlock/HouseholdDataBlock.js +++ b/src/Components/HouseholdDataBlock/HouseholdDataBlock.js @@ -13,7 +13,6 @@ import { householdMemberAgeHasError, displayHouseholdMemberAgeHelperText, personDataIsValid, - useErrorController, selectHasError, relationTypeHelperText, } from '../../Assets/validationFunctions.tsx'; @@ -36,7 +35,7 @@ const HouseholdDataBlock = ({ handleHouseholdDataSubmit }) => { const setPage = (page) => { navigate(`/${uuid}/step-${step}/${page}`); }; - const ageErrorController = useErrorController(householdMemberAgeHasError, displayHouseholdMemberAgeHelperText); + const [submittedCount, setSubmittedCount] = useState(0); const initialHouseholdData = formData.householdData[page - 1] ?? { age: '', @@ -118,7 +117,7 @@ const HouseholdDataBlock = ({ handleHouseholdDataSubmit }) => { defaultMessage="How old are you?" /> - {createTextField(ageTextfieldProps, ageErrorController)} + {createTextField(ageTextfieldProps, submittedCount)}
> ); @@ -134,18 +133,18 @@ const HouseholdDataBlock = ({ handleHouseholdDataSubmit }) => { defaultMessage="If your child is less than a year old, enter 0." /> - {createTextField(ageTextfieldProps, ageErrorController)} + {createTextField(ageTextfieldProps, submittedCount)} > ); } }; - const createTextField = (componentInputProps, errorController) => { + const createTextField = (componentInputProps, submittedCount) => { return (