question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field#validate not running on form submit

See original GitHub issue

Bug, 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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jaredpalmercommented, Jun 28, 2018

Deployed in latest beta. Let me know how it goes. I’m surprised more ppl didn’t speak up about this sooner

0reactions
stefanwillecommented, Jun 28, 2018

Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found