fix: restrict patient name to alphabetic characters only
Related issue :#292 (closed)
Overview
This MR fixes a validation issue in the Patient Name field where numeric values were being accepted. The field should only allow alphabetic characters.
What does this MR do and why?
The Patient Name field previously allowed numeric input (e.g., "211"), which leads to invalid patient data.
This MR adds validation to restrict the input to only alphabetic characters and spaces.
The approach taken:
- Added regex-based validation
- Prevented form submission for invalid input
- Displayed an error message for better user feedback
Changes Made
- Modified Patient Name input validation logic
- Added regex validation (
^[A-Za-z\s]+$) - Added error handling for invalid input
- Prevented submission when validation fails
Technical Details
Root Cause: No validation was implemented to restrict numeric input.
Fix:
- Introduced regex validation to allow only letters and spaces
- Integrated validation into form handling logic
Type of Change
-
🐛 Bug fix (non-breaking change that fixes an issue) -
✨ New feature -
💥 Breaking change -
📝 Documentation update -
🎨 UI/UX improvement -
♻ ️ Refactor -
⚡ Performance improvement -
🧪 Test update -
🔧 Configuration change -
🚨 Security fix
Related Issues / References
Closes #
Screenshots or Screen Recordings
| Before | After |
|---|
| Accepts "211" without error | Shows validation error and blocks submission |
How to Set Up and Validate Locally
- Checkout this branch:
git checkout fix/patient-name-validation