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 onSubmit, but don't validate onChange or onBlur

See original GitHub issue

After exploring the API, the examples and reading through the similar issues, I still don’t have a straight forward solution for this problem, so I am asking for your help.

I don’t want to validate each input field onChange or onBlur, but I want to validate all input fields onSubmit. What would be the best way to approach this problem?

The form validation is synchronous and I am using version 6.3.2.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

15reactions
andynoelkercommented, Jan 11, 2017

Redux Form will run the validation function against any touched Fields. You need to configure Redux Form to not touch fields on a blur event by setting touchOnBlur to false in the Redux Form config. (By default, this is already false for change events).

export default reduxForm({ form: 'myForm', touchOnBlur: false })(MyForm);
3reactions
danielrobcommented, Aug 7, 2017

Why not use shouldValidate config property and return false unless props.submitting is true?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validate onSubmit, but don't validate onChange or onBlur #2413
I don't want to validate each input field onChange or onBlur , but I want to validate all input fields onSubmit . What...
Read more >
react-hook-form: Validation not working when using onBlur ...
1 Answer 1 ; onChange, string, Validation will trigger on the change event with each input, and lead to multiple re-renders. Warning: this...
Read more >
Spry Password Validation Widget - Adobe Open Source
The validation event can be 'onChange' - this means the validation will be triggered as you type. 'onBlur' - when the password field...
Read more >
useField (Remix Validated Form)
Validates the form field and populates the error prop if there is an error. ... the values ( onChange , onBlur , onSubmit...
Read more >
useForm | React Hook Form - Simple React forms validation
Validation will trigger on the submit event and inputs will attach onChange event listeners to re-validate them. onBlur, string, Validation will trigger on...
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