Validate only touched fields
See original GitHub issueAre you submitting a bug report or a feature request?
Feature request
What is the current behavior?
It’s not possible to detect if field is touched or not in validate
function.
What is the expected behavior?
It’s possible to distinguish touched and untouched fields in validate
function.
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Validate only one field at a time · Issue #512 · jaredpalmer/formik
Formik validate function - pass the event's field name. It will allow the developer to validate only one field at a time.
Read more >Formik + Yup blur all the fields even if only one field is touched ...
This is working fine but there is only one problem. I have 5 fields firstname, lastname, email, password, confirmpassword. If I touch the ......
Read more >Validation - Formik
Formik is designed to manage forms with complex validation with ease. Formik supports synchronous and asynchronous form-level and field-level validation.
Read more >React Form Validation With Formik And Yup
In this article, we will learn how to handle form validation and track the state of forms without the aid of a form...
Read more >Synchronous Validation Example - Redux Form
error value will always be present. You will probably only want to show validation errors once your field has been touched, a flag...
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 FreeTop 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
Top GitHub Comments
Another way to do it is to validate each field individually, and then use the getFormErrors selector to get all of the errors for the form, and then parse out the errors that you want to display from there.
As far as I know, a field that’s
pristine
won’t havesyncError
s attached to it. What’s the issue you’re running into?For example, if you have a field with
required
validation, it won’t throw an error on that field until you either touch the field or try to submit the form.