Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation check for phone number in patient list page #8189 #8394

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ export const PatientManager = () => {
qParams.phone_number && updateQuery({ phone_number: null });
return;
}

setPhoneNumberError("Enter a valid number");
};

const setEmergencyPhoneNum = (emergency_phone_number: string) => {
Expand All @@ -141,8 +139,6 @@ export const PatientManager = () => {
updateQuery({ emergency_phone_number: null });
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To continue with the error, i.e., 8-digit and 9-digit phone numbers are considered valid. This is because it is validating telephone numbers and other numbers that are more than 10 digits 13 digits. Can I get some suggestions to correct this?

Copy link
Member

@rithviknishad rithviknishad Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to clear the error if we are not setting the error state with a value in the first place right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but what about this issue 8 digit and 9 digit numbers are considered as valid because it is validating telephone number also !.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can trigger the search as soon as the number is considered valid. Use the PhoneNumberValidator utility to achieve that.

}

setEmergencyPhoneNumberError("Enter a valid number");
};

const tabValue =
Expand Down
Loading