Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate that fields match #121

Closed
keeganstothert opened this issue Dec 13, 2019 · 1 comment
Closed

validate that fields match #121

keeganstothert opened this issue Dec 13, 2019 · 1 comment

Comments

@keeganstothert
Copy link

keeganstothert commented Dec 13, 2019

I cannot validate that two fields match (password/verify password, etc) because the validators are only run for the individual fields. Is there a way to trigger validation across all fields or even to manually set invalid state so i can manage it myself?

this would be great,
setFieldValidity('fieldName', false)

@wsmd
Copy link
Owner

wsmd commented Dec 20, 2019

Hi @keeganstothert – I don't believe it's currently possible to trigger validation across all fields because validation requires a change/blur event that is only available when a user interact with an input. This library also falls back to HTML5 validation if a custom validate function isn't specified, but that also (currently) requires access to the DOM node which is only accessible via the change/blur event itself.

That said, I think it might be actually possible to expose something like setFieldValidity so that you can manage the validation state manually! I'll look into that soon! 👍 In the meantime, could you please give me an example of how something like setFieldValidity would solve your use case (validating matching fields)?

@wsmd wsmd closed this as completed May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants