"react-dom": "^16.8.6",
"react-hook-form": "^3.9.0",
"react-redux": "^7.0.3",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-hook-form": "^3.9.0",
Everything is up-to-date at the time of writing this.
To Reproduce
Steps to reproduce the behavior:
- Install the currently latest versions of react related libraries
- Use
useForm()
in a functional component.
- Observe the exception
Expected behavior
The app should not crash.
Desktop (please complete the following information):
- OS: Windows
- Browser Chrome
- Version 69.0.3497.92
Additional context
might be related to this
Is your feature request related to a problem? Please describe.
If a user doesn't enter a value, the validation doesn't happen until submission. However, if I am in a wizard (a single form has multiple steps), I want to prevent someone from continuing to the next step. If someone clicks the next button, the fields are not checked so the user cannot be prevented.
Describe the solution you'd like
I'd like a function returned by useForm
to trigger a validation of the fields. Bonus points to also accept string | string[]
fields to only validate given fields.
Describe alternatives you've considered
Currently I have to also use getValues
but this doesn't show the error message then:
validate: (): boolean => !errors.title && Boolean(getValues().title),
I'd like to do:
validate: (): boolean => validate('title')
And the errors
object then have an error (if the field is invalid) so that my form can show the error also. From what I've seen in the code, the validation is only internal and no way for me to get to it easily and the different modes
don't handle if the field was never focused.
Describe the bug
I am using react-hook-form with nextjs. After I submit my form for the first time (with intended errors) it works fine. But when I remove the errors (edit the values of inputs) I can't submit the form again hence the errors don't disappear and the whole form doesn't react to submitting.
I have to refresh the page.
Expected behavior
Expected behavior would be that the errors disappear and the form gets submitted again.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Version: 75.0.3770.80
Additional context
Add any other context about the problem here.