Replies: 1 comment
-
Sorry for the delay. in their official example: const passwordForm = z
.object({
password: z.string(),
confirm: z.string(),
})
.refine((data) => data.password === data.confirm, {
message: "Passwords don't match",
path: ["confirm"], // path of error
})
.parse({ password: "asdf", confirm: "qwer" }); So |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello community
I am trying to understand how one can validate a password and a confirm password field using vee validate and zod library.
I managed to understand how to use
useField
anduseForm
in separate components, but now I don't understand how can I validate values from two components.For example, I have to following form and I want to validate that
password
field is the same withconfirm-password
I don't quite understand how can I do this validation
I know
zod
has a method using therefine
method, but I don't understand how can I use it in two different componentsI tried to use validationSchema object in
useForm
, but then the form and its fields are valid by defaultDo you have any tips for me?
Beta Was this translation helpful? Give feedback.
All reactions