You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's the best way to ensure a field's value matches the value of another? For example, two password fields matching?
I don't see any way to do this via validationSchema so I assume I need a per-field validation object that reads the value of another field? I'm just not sure on how to get the value of the other field in this context.
function validateUsername(value) {
let error;
if (value === otherPasswordField.value) { // ? how do I get the other field
error = 'Passwords must match';
}
return error;
}```
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What's the best way to ensure a field's value matches the value of another? For example, two password fields matching?
I don't see any way to do this via validationSchema so I assume I need a per-field validation object that reads the value of another field? I'm just not sure on how to get the value of the other field in this context.
Beta Was this translation helpful? Give feedback.
All reactions