diff --git a/src/app/dashboard/(admin)/admin/(settings)/settings/organization/roles-and-permissions/create-role/page.tsx b/src/app/dashboard/(admin)/admin/(settings)/settings/organization/roles-and-permissions/create-role/page.tsx index b52da934e..a9644b8ae 100644 --- a/src/app/dashboard/(admin)/admin/(settings)/settings/organization/roles-and-permissions/create-role/page.tsx +++ b/src/app/dashboard/(admin)/admin/(settings)/settings/organization/roles-and-permissions/create-role/page.tsx @@ -136,8 +136,9 @@ function CreateNewRolePage() { handleSubmit, formState: { errors }, setValue, + trigger, } = useForm({ - mode: "onBlur", + mode: "onChange", resolver: zodResolver(roleSchema), }); @@ -199,6 +200,10 @@ function CreateNewRolePage() { } }; + const handleInputChange = (field: keyof UseFormInputs) => { + trigger(field); + }; + return (
@@ -229,17 +234,28 @@ function CreateNewRolePage() { handleInputChange("name"), + })} + className={`!w-full rounded-md border ${ + errors.name ? "border-red-500" : "border-border" + } bg-transparent px-3 py-2 shadow-sm outline-none focus:border-primary focus:ring-ring md:w-56`} /> + {errors.name && ( +

{errors.name.message}

+ )}
+
{errors.permissions && ( -

Please select valid permissions.

+

+ {errors.permissions.message} +

)}
@@ -271,9 +289,18 @@ function CreateNewRolePage() {