added validation for character limit, user can't add more than 200 character for description
This commit is contained in:
parent
7308bd8d03
commit
868f5038b0
@ -12,7 +12,7 @@ import {checkIfCurrentDate} from "../../utils/dateUtils";
|
||||
|
||||
const schema = z.object({
|
||||
markTime: z.string().nonempty({message:"Time is required"}),
|
||||
description:z.string().optional()
|
||||
description:z.string().max(200,"description should less than 200 chracters").optional()
|
||||
});
|
||||
|
||||
const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => {
|
||||
@ -29,7 +29,8 @@ const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => {
|
||||
reset,
|
||||
setValue,
|
||||
} = useForm({
|
||||
resolver: zodResolver(schema),
|
||||
resolver: zodResolver( schema ),
|
||||
mode:"onChange"
|
||||
});
|
||||
|
||||
const onSubmit = ( data ) =>
|
||||
@ -84,7 +85,8 @@ const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => {
|
||||
rows="3"
|
||||
name="description"
|
||||
className="form-control"
|
||||
{...register("description")}
|
||||
{...register( "description" )}
|
||||
maxLength={200}
|
||||
/>
|
||||
{errors.description && (
|
||||
<p className="text-danger">{errors.description.message}</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user