Zod validation does not show refine errors
See original GitHub issueHey, I started to play around with remix and enjoy using this library so far since I used Zod in my Blitz.js projects as well. Right now I have a problem that my refined validations are not shown as error.
My validator: `const password = z .string() .min(6, “Das Passwort darf maximal 6 Zeichen lang sein”) .max(100);
export const registerValidator = withZod( z .object({ email: z.string().email(), password, passwordConfirmation: password, }) .refine((data) => data.password === data.passwordConfirmation, { message: “Passwords don’t match”, path: [“passwordConfirmation”], }) );`
My Form:
export const RegisterForm = () => ( <ValidatedForm validator={registerValidator} method={"post"}> <Stack spacing="6"> <TextField label={"E-Mail"} name={"email"} /> <PasswordField label={"Passwort"} name={"password"} /> <PasswordField label={"Passwort Bestätigen"} name={"passwordConfirmation"} /> <Button type="submit" colorScheme="blue" size="lg" fontSize="md"> Registrieren </Button> </Stack> </ValidatedForm> );
The normal validation for email / password and passwordConfirmation is working so far but the refined value never shows. Is there anything I am doing wrong or are these refined values not supported yet?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
@airjp73 Sorry, there was an error with my zod schema. Just figured it out and it is working now!
That resolved the error 👍 I will updated the
CONTRIBUTING.md
with another pull request after I am done