-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Matching fields example (ie. Passwords) #90
Copy link
Copy link
Closed
Description
I'm struggling with getting a Yup validation working to ensure two fields match (in this case, password and password confirm).
validationSchema: Yup.object().shape({
password: Yup.string()
.required('Password is required'),
passwordConfirm: Yup.mixed().test('match', 'Passwords do not match', function (password) {
return password === this.parent.passwordConfirm
}).required('Password confirm is required')
}),I'm new to Formik & Yup (and relatively new to JS generally). Really appreciate any pointers.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels