Add example how to validate than one field matches another
See original GitHub issueI cannot find any example or appropriate function in the API how to make sure that one field has the same value as another (string in my case). Use case matching password and passwordRepeat fields.
I’m thinking I need to use ref
, but I’m not sure how exactly. I was thinking of matches
(but can I pass exact field value there) or oneOf
.
yup.object().shape({
newPassword: yup.string().min(5).required().label('New password'),
reNewPassword: yup.string(),
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
java - How can I validate two or more fields in combination?
This String, we will add to a set by using add() of set which will return false if duplicate comes up. Based on...
Read more >Restrict data input by using validation rules - Microsoft Support
On the Fields tab, in the Field Validation group, click Validation, and then click Record Validation Message. Enter an appropriate message. For example,...
Read more >REGEX - How to match and search any pattern or validate ...
This video covers the most important uses of regex: - regex match (used to check if a string matches a specific regex rule)...
Read more >Cross Field Validation - VeeValidate
To reference another field's value, add a @ at the beginning of a param to signal to vee-validate that it should substitute the...
Read more >Excel Data Validation using regular expressions (Regex)
To be able to validate cell input using regular expressions, you need to create a custom Regex function first. Another complication is that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The example that @jquense posted isn’t working for me. This is what worked for me:
I got it from https://github.com/jquense/yup/issues/164
@chodorowicz This can be just: