Don't validate onSubmit
See original GitHub issueCurrent Behavior
Can not determine if validate
was fired from blur
, change
, or handleSubmit
Desired Behavior
detect what event fired validate
Suggested Solutions
pass a flag that says what event fired validate
Info
I need the ability to tell if validate
was fired from handleSubmit
so I can only validate onChange
and onBlur
. Is there a way to do this currently?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:11 (3 by maintainers)
Top Results From Across the Web
How can I disable validation on submit?
I have a workaround for you: Just remove the validation Schema, validateOnMount, validateOnBlur because we are going to handle them ...
Read more >useForm - handleSubmit
This function will receive the form data if form validation is successful. ... It can be invoked remotely as well handleSubmit(onSubmit)(); // You...
Read more >Validation
Form-level validation is useful because you have complete access to all of your form's values and props whenever the function runs, so you...
Read more >How to stop form submission using JavaScript?
<form onsubmit="return false;"> //content of form tag </form> ... In this method we do not need to use the onsubmit event instead we...
Read more >Batch validation
Batch validation checking typically operates from the onsubmit event ... />I do not agree <br> <input type="reset" /> <input type="submit" /> </form>.
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
Thanks very much for working on Formik. It’s a great library.
However this functionality is something we would like and is not quite a duplicate of #126. We would like to be able to tell the difference between a validation that is the result of a blur or change and a validation that is the result of a submit.
This is because with a on submit validation failure we want to be able to scroll the user to the invalid field, while on blur and change we want to display the error and not run anything around scrolling. Currently I cannot work out a way to do this without a significant and ugly hack, so would appreciate this feature.
Validation is always run on submit.