diff --git a/src/Components/Users/UserAdd.tsx b/src/Components/Users/UserAdd.tsx index 4c63868b19e..b3fc9b830f8 100644 --- a/src/Components/Users/UserAdd.tsx +++ b/src/Components/Users/UserAdd.tsx @@ -366,8 +366,7 @@ export const UserAdd = (props: UserProps) => { state.form.user_type === "Doctor" && Number(state.form.doctor_experience_commenced_on) > 100 ) { - errors["doctor_experience_commenced_on"] = - "Doctor experience should be less than 100 years"; + errors[field] = "Doctor experience should be less than 100 years"; invalidForm = true; } return; diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx index 170de558e41..767fc9b73b8 100644 --- a/src/Components/Users/UserProfile.tsx +++ b/src/Components/Users/UserProfile.tsx @@ -244,8 +244,19 @@ export default function UserProfile() { invalidForm = true; } return; - case "doctor_qualification": case "doctor_experience_commenced_on": + if (states.form.user_type === "Doctor" && !states.form[field]) { + errors[field] = "Field is required"; + invalidForm = true; + } else if ( + states.form.user_type === "Doctor" && + Number(states.form.doctor_experience_commenced_on) > 100 + ) { + errors[field] = "Doctor experience should be less than 100 years"; + invalidForm = true; + } + return; + case "doctor_qualification": case "doctor_medical_council_registration": if (states.form.user_type === "Doctor" && !states.form[field]) { errors[field] = "Field is required";