Skip to content

Commit

Permalink
add max validation for doctor experience in user profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharsh05 committed Feb 4, 2024
1 parent dd15fe4 commit 412286e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Components/Users/UserAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion src/Components/Users/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 412286e

Please sign in to comment.