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.

Validation gets triggered on blur even the mode was set to 'onChange'

See original GitHub issue

Describe the bug Hi, I just found a bug with the onChange mode. Validation gets triggered on blur even the mode was set to onChange

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/react-hook-form-controller-1wurt
  2. Click on Uncontrolled input textbox (dont type anything)
  3. Remove the focus
  4. Error is shown

Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-controller-1wurt

Expected behavior Error should not be shown if the mode is onChange because the user doesn’t perform any input changes. This should only happen if the mode is onBlur

Desktop (please complete the following information):

  • OS: Mac OS Mojave
  • Browser: chrome
  • Version: 80.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
bluebill1049commented, Mar 17, 2020

5.1.2-beta.1 here you go.

1reaction
bluebill1049commented, Mar 16, 2020

no, not really. i will have to release a beta version for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error validation after onBlur. Clear error onChange until the ...
Set the validation mode: "onBlur"; Clear the field's error onChange via clearErrors form method if there's an error.
Read more >
react-hook-form: Validation not working when using onBlur ...
Validation will trigger on the blur event. Validation will trigger on the change event with each input, and lead to multiple re-renders.
Read more >
Do not validate when typing, but on blur - Telerik UI for Blazor
Telerik UI for Blazor 2.30 adds a ValidateOn parameter to input components. It defines the event that triggers validation ( OnChange or OnInput...
Read more >
react hook form onblur not working - You.com | The AI Search ...
In your code, the form mode is onBlur . it means the validation is triggered on blur event (unfocus the input). When you...
Read more >
useForm | React Hook Form - Simple React forms validation
mode : onChange | onBlur | onSubmit | onTouched | all = 'onSubmit' ... to configure validation strategy when inputs with errors get...
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