react-hook-form, two fields in one `FormItem`?
Unanswered
Da_v_id posted this in #help-forum
Da_v_idOP
Hello, hello, how can I pass two inputs in one FormItem with shadcn and react-hook-form?
My category zod mode:
My category zod mode:
const CategoryValidation = z.object({
name: z.string().min(3, { message: "Minimun 3 characters." }).max(32, { message: "Maximum 32 characters." }),
description: z.string().max(200, { message: "Maximum 200 characters." }),
nature: z.string().refine((value) => (Object.values(CATEGORY_NATURES_ENUM) as string[]).includes(value), { message: "Invalid nature." }),
icon: z.string().refine((value) => Array.from(CATEGORY_ICONS_ALIASES.keys()).includes(value), { message: "Invalid icon." }),
color: z.string().refine((value) => CATEGORY_COLORS.includes(value), { message: "Invalid color." }),
depth: z.number().min(0).max(2, { message: "You can't create nested categories at this level." }).default(0),
});
export { CategoryValidation};1 Reply
Da_v_idOP