Field#validate not running on form submit
See original GitHub issueBug, Feature, or Question?
Bug
Current Behavior
I have a form with fields email and password and a submit button. Both fields are added as <Field>
with a validate
property.
If I submit the form without focusing any of the fields, the functions in validate
are never run and I don’t see an error message.
I have to focus one of the fields to see an error message.
Please see https://codesandbox.io/s/107rvl2vxj
Desired Behavior
The functions in validate
should run before form submission.
Suggested Solutions
Additional Information
- Formik Version: 0.11.11
- React Version: 16.2.0
- TypeScript Version: -
- CodeSandbox Link: https://codesandbox.io/s/107rvl2vxj
- OS: MacOS
- Node Version: 8.9.4
- Package Manager and Version: yarn 1.5.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Required Field Validator Not Firing - asp.net - Stack Overflow
Generally speaking, Validate() gets called whenever a control is clicked that has CausesValidation set to true, like a submit button.
Read more >Required field validators not working on button click - MSDN
My goal is to have error messages to popup whenever a required field is not populated. It has to be validated right after...
Read more >Can not submit form after validation - FormValidation
If the form can't be submitted, the reason might be caused by using name="submit" or id="submit" attribute for the submit button. Behind the...
Read more >Validating form input - Angular
A cross-field validator is a custom validator that compares the values of different fields in a form and accepts or rejects them in...
Read more >Stopping Form Submissions - Cordial Knowledge Base
If you return false for the Event Trigger Before Form Validation then the normal validation will not run and the form will not...
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 Free
Top 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
Deployed in latest beta. Let me know how it goes. I’m surprised more ppl didn’t speak up about this sooner
Thanks