From 6998714fea3d13a688730891481abe67f3beb6da Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Tue, 9 Sep 2025 12:51:19 +0530 Subject: [PATCH] Contact Number Field Accepts More Than 10 Digits in Create/Update Contact --- src/components/Directory/ManageDirectory.jsx | 38 ++++++-------------- src/components/Directory/UpdateContact.jsx | 9 ++++- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/components/Directory/ManageDirectory.jsx b/src/components/Directory/ManageDirectory.jsx index 5c858815..6b7cf8ff 100644 --- a/src/components/Directory/ManageDirectory.jsx +++ b/src/components/Directory/ManageDirectory.jsx @@ -40,7 +40,7 @@ const ManageDirectory = ({ submitContact, onCLosed }) => { const { designationList, loading: designloading } = useDesignation(); const { contactTags, loading: Tagloading } = useContactTags(); const [IsSubmitting, setSubmitting] = useState(false); - const [showSuggestions,setShowSuggestions] = useState(false); + const [showSuggestions, setShowSuggestions] = useState(false); const [filteredDesignationList, setFilteredDesignationList] = useState([]); const dispatch = useDispatch(); @@ -132,6 +132,12 @@ const ManageDirectory = ({ submitContact, onCLosed }) => { setValue("designation", val); }; + // Handle phone number input to only allow numbers and max length of 10 + const handlePhoneInput = (e) => { + const value = e.target.value.replace(/[^0-9]/g, ""); + e.target.value = value.slice(0, 10); + }; + const toggleBucketId = (id) => { const updated = watchBucketIds?.includes(id) @@ -277,23 +283,11 @@ const ManageDirectory = ({ submitContact, onCLosed }) => { placeholder="email@example.com" /> {index === emailFields.length - 1 ? ( - //