Replies: 3 comments 5 replies
-
that's not an issue with rhf rather MUI doesn't suppose onChane at the form. u can attach onChane on those components tho. |
Beta Was this translation helpful? Give feedback.
4 replies
-
I have same problem. A normal text field triggers onChange of rhf, but a select field doesn't trigger onChange https://codesandbox.io/s/selecttextfields-material-demo-forked-m52cw?file=/demo.tsx |
Beta Was this translation helpful? Give feedback.
1 reply
-
Old question, but for SEO posterity, this can also be caused by having no default value (ie default value is |
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
-
I need to trigger an action when a value in form changes.
However, when I add onChange event to form element (
<form onChange={onChange} >
) then it is not triggered for these MUI inputs: Select, Slider, Autocomplete.Any idea how to propagate the onChange event to the form component?
I noticed that for Autocomplete, the onChange is called when you write in the text field but not when you select an item.
Does react-hook-form have any other mechanism to call a function when a value in the form changes?
I cannot use watch() because it is not called ONLY when a value change.
https://codesandbox.io/s/react-hook-form-controller-forked-dcle5?file=/src/index.js
Beta Was this translation helpful? Give feedback.
All reactions