Clear selected values on RHF with MUI AutoComplete multiple #11048
Replies: 3 comments
-
I'm having the same problem here, I have an Autocomplete element and the reset method doesn't work for this type of fields, I tried the remove method in the useFieldArray hook without any result. Did you find a solution for this? |
Beta Was this translation helpful? Give feedback.
-
@shrikumarhegde, |
Beta Was this translation helpful? Give feedback.
-
Yep, same. Tried out this: const formData = form.getValues();
formData.forEach(fieldData => form.setValue(fieldData.field, null)); It does clear the value to null, but selected options can be seen inside Input |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using the latest RHF for MUI autocomplete with multiple select options.
here is the demo link https://codesandbox.io/s/react-hook-form-with-autocomplete-7377js?file=/src/App.js
I want to clear the model dropdown value when the brand dropdown changes.
I tried using setValue and resetField, it is clearing the data in hook form, but chips are still visible. I want to remove all selected chips when the model changes.
Beta Was this translation helpful? Give feedback.
All reactions