Replies: 3 comments
-
Hey @logaretm would you be able to point me to the function where I might do this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Check Handling Invalid Submissions. With the information passed in the invalid callback you can try to locate the element and scroll to it. const onSubmit = handleSubmit(async fields => {
// ...
}, ({ errors }) => {
const fieldName = Object.keys(errors)[0];
// assumes your fields has an `id` attribute equal to their names.
document.querySelector(`#${fieldName}`)?.scrollIntoView();
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Wow....... I stared at the docs for useForm for so long, I don't know how I missed that. Thank you |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to scroll to the first input that has an error. Currently I'm doing this:
Setup:
Beta Was this translation helpful? Give feedback.
All reactions