Skip to content

Commit 6f16db4

Browse files
Apply separate logic for next button disable for the Eligibility step
1 parent dc5592b commit 6f16db4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • src/react/src/components/InitialClaimFlow/ClaimForm

src/react/src/components/InitialClaimFlow/ClaimForm/hooks.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useFormik } from 'formik';
33
import { isEmpty } from 'lodash';
44
import { getValidationSchemaForStep } from './validationSchemas';
55
import { claimIntroRoute } from '../../../util/constants';
6+
import { CLAIM_FORM_STEPS } from './constants';
67

78
export const usePrefetchClaimData = (
89
fetchCountries,
@@ -128,6 +129,23 @@ export const useClaimForm = (
128129
field => formik.errors[field],
129130
);
130131

132+
// Check if select field has a value selected
133+
const noSelectedOption = currentStepFields.some(field => {
134+
const value = formik.values[field];
135+
136+
if (value && value !== '') {
137+
return false;
138+
}
139+
140+
return true;
141+
});
142+
143+
// For eligibility step, only check errors and no selected option
144+
if (activeStep === CLAIM_FORM_STEPS.ELIGIBILITY) {
145+
return hasCurrentStepErrors || noSelectedOption;
146+
}
147+
148+
// For other steps, only check if user has interacted and has errors
131149
return hasInteractedWithCurrentStep && hasCurrentStepErrors;
132150
};
133151

0 commit comments

Comments
 (0)