-
Notifications
You must be signed in to change notification settings - Fork 125
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
Possibility to validate all fields #79
Comments
I think you could do this by keeping track of the current valid status using the callbacks and then triggering a submit on the form. Triggering a submit will show all the errors, and you can keep track of the boolean with Is there something I'm missing? |
What @rkuykendall said. It corresponds to the controlled inputs paradigm but the whole form is controlled in this case, storing validity in state instead of a value. It's usually not recommended to use refs to call methods on a child unless you really have a good reason. I guess we could consider a PR to support a method as an alternate way to validate the form but someone would have to submit one. |
@rkuykendall So, what i'm doing wrong? The form is being submited, but there isn't any form validation.
|
Please clarify "there isn't any form validation". Is onValid and onInvalid not being called when you click on the button outside the form? Also a working jsfiddle/jsbin/whatever or a git repo reproducing the issue would be nice. I don't think
is valid jsx. My team also had an issue with submitting the form with a button outside the form, but it wasn't related to validation. We ended up moving it into the form but one solution I really liked was the form attribute on button: You'd need a polyfill for IE though which handles the click similarly to your handleClick() method. We might want to look into supporting this in a browser-agnostic way through Formsy. |
inactive, closing |
The library actually doesn't allow to manually validate all inputs. The idea is to call the method, show all errors and return a boolean, which contains if the form is valid, or is not.
The text was updated successfully, but these errors were encountered: