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

Disallow picking out of range month or year in date input dropdown #9064

Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4968551
Disallowing picking out of range month or year
Rishith25 Nov 8, 2024
4da071b
Disallow picking out of range month and year
Rishith25 Nov 8, 2024
03557ad
Disallow picking out of range month and year
Rishith25 Nov 8, 2024
99f0838
Added error message for months and year
Rishith25 Nov 8, 2024
18842b5
Merge branch 'develop' into Disallow-picking-out-of-range-month-or-year
nihal467 Nov 12, 2024
3cee506
Merge branch 'develop' into Disallow-picking-out-of-range-month-or-year
nihal467 Nov 18, 2024
9086a58
fixed doctor calling button size and added types (#9130)
nithish1018 Nov 18, 2024
12480c7
Design of List View layout in Resource Page (#9096)
AnveshNalimela Nov 18, 2024
e949aa0
disable "Save Button" if no file is selected (#9111)
Srayash Nov 18, 2024
04d6df2
Fixed:Show more monitors in CNS on very large displays #6503 (#9013)
i0am0arunava Nov 18, 2024
cacab63
Add Cypress Test Suite for Sample Test Request Workflow (#8977)
JavidSumra Nov 19, 2024
649fe69
Tests to verify error handling and access restrictions during Facilit…
Alokih Nov 19, 2024
9c0c5f9
Login page input fields UI update (#9125)
Rishith25 Nov 19, 2024
e8da693
Fix: Bed capacity pop up errors (#9123)
AdityaJ2305 Nov 19, 2024
88e4729
Enhanced care config to validate env during build process (#9032)
Alokih Nov 19, 2024
b1b5db5
Added SpO2 field in community log update for nurses (#8907)
noufalrahim Nov 19, 2024
e7c3210
added a missing translation (#9131)
khavinshankar Nov 19, 2024
8dfdf34
fix: Resolve creation of patient name despite having numeric values (…
Tanuj1718 Nov 20, 2024
547f413
Adjusted SpO2 thresholds and labels in DailyRounds component to match…
AdityaJ2305 Nov 20, 2024
71c9f9b
Fix: Year Of Birth Field Validation Condition in Patient transfer for…
AdityaJ2305 Nov 20, 2024
f665dbc
Fix: TypeError in notification list (#8935)
AdityaJ2305 Nov 20, 2024
67e735f
Enhancements to the nursing care procedures and routines tables (#9079)
sainak Nov 20, 2024
82753be
Add function to authorize user to register patient (#9000)
JavidSumra Nov 20, 2024
9ec952d
Refactored the pagination component in cypress (#9163)
nihal467 Nov 20, 2024
e840589
fix plausible site domain env validation (#9168)
rithviknishad Nov 20, 2024
e48549f
Fixed the cypress env config file and removed hardcoded fallback (#9184)
nihal467 Nov 22, 2024
4df1ed2
Updated the disallowing of date range
Rishith25 Nov 25, 2024
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
Prev Previous commit
Next Next commit
fix: Resolve creation of patient name despite having numeric values (#…
Tanuj1718 authored and Rishith25 committed Nov 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8dfdf345db21fb325cefb70659d2f3c4bc90d34d
6 changes: 5 additions & 1 deletion src/components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ import {
} from "@/common/constants";
import countryList from "@/common/static/countries.json";
import { statusType, useAbortableEffect } from "@/common/utils";
import { validatePincode } from "@/common/validation";
import { validateName, validatePincode } from "@/common/validation";

import { PLUGIN_Component } from "@/PluginEngine";
import { RestoreDraftButton } from "@/Utils/AutoSave";
@@ -421,6 +421,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
switch (field) {
case "address":
case "name":
if (!validateName(form[field])) {
errors[field] = "Please enter valid name";
}
return;
Comment on lines +426 to +429
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove name validation for address field

The name validation is incorrectly applied to both name and address fields. Address fields should allow special characters, numbers, and other characters that might be invalid for names.

Apply this diff to fix the validation:

-if (!validateName(form[field])) {
-  errors[field] = "Please enter valid name";
-}
+if (field === "name") {
+  if (!validateName(form[field])) {
+    errors[field] = "Please enter valid name";
+  }
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!validateName(form[field])) {
errors[field] = "Please enter valid name";
}
return;
if (field === "name") {
if (!validateName(form[field])) {
errors[field] = "Please enter valid name";
}
}
return;

case "gender":
errors[field] = RequiredFieldValidator()(form[field]);
return;