diff --git a/src/modules/Dashboard/modules/ManageUsers/UserForm.tsx b/src/modules/Dashboard/modules/ManageUsers/UserForm.tsx index cf3fa4f2c..a472ee4e3 100644 --- a/src/modules/Dashboard/modules/ManageUsers/UserForm.tsx +++ b/src/modules/Dashboard/modules/ManageUsers/UserForm.tsx @@ -142,7 +142,15 @@ const UserForm = forwardRef( const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; - setData(prevData => ({ ...prevData, [name]: value })); + if (name === "mobile" && value && !/^\+?\d{0,12}$/.test(value.trim())) { + setErrors(prevErrors => ({ + ...prevErrors, + mobile: "Invalid format" + })); + } else { + setErrors(prevErrors => ({ ...prevErrors, mobile: undefined })); + setData(prevData => ({ ...prevData, [name]: value.trim() || " " })); + } }; const handleYearChange = (e: React.ChangeEvent) => { @@ -373,7 +381,7 @@ const UserForm = forwardRef(
= ({ title, desc, duration, rootId }) => { return (
@@ -108,7 +115,9 @@ function getRootIdByTitle(titleToSearch: string): string {
); }; - + if (isLoading) { + return ; + } return (

Wadhwani Foundation Courses