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.

Validate only touched fields

See original GitHub issue

Are 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:open
  • Created 6 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
tstirrat15commented, Apr 6, 2017

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.

1reaction
tstirrat15commented, Apr 5, 2017

As far as I know, a field that’s pristine won’t have syncErrors 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.

Read more comments on GitHub >

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

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