From 8dfdf345db21fb325cefb70659d2f3c4bc90d34d Mon Sep 17 00:00:00 2001 From: Tanuj Nainwal <125687187+Tanuj1718@users.noreply.github.com> Date: Wed, 20 Nov 2024 07:44:38 +0530 Subject: [PATCH] fix: Resolve creation of patient name despite having numeric values (#9152) --- src/components/Patient/PatientRegister.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Patient/PatientRegister.tsx b/src/components/Patient/PatientRegister.tsx index 5cc958d44de..a7a7743aee4 100644 --- a/src/components/Patient/PatientRegister.tsx +++ b/src/components/Patient/PatientRegister.tsx @@ -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; case "gender": errors[field] = RequiredFieldValidator()(form[field]); return;