react-hook-form-mui
react-hook-form-mui copied to clipboard
[Feature Request] Allow Autocomplete component to perform async actions using current text input
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Summary 💡
I would like to be able to, upon text entry, query my backend. I cant seem to hook into onInputChange without altering the way the lifecycle works. Once I add onInputChange, the input is no longer being rendered, I try to pass the useState value into it, but for the life of me I cannot get it to work. I imagine this may have to do with the RHF integration?
How would you suggest basically listening for text input changes without mucking up the lifecycle?
Examples 🌈
No response
forgot to mention, looks highly related to #9, and the solution there is "load all the records", but I'd really like the user to be able to refine the records with a term sent to the backend.
this seems to work for single, but breaks down when setting the multiple prop
<AutocompleteElement
label="parents"
name="parents"
options={relationOptions}
value={term}
autocompleteProps={{
onInputChange: (event, value) => {
setTerm(value);
},
}}
/>
@DoWhileGeek do you mind setting up a codepen for this? if things doesnt work with multiple prop, usually the default value isn't an empty array or value is not casted correctly. As this plugin only handles the react-hook-form part, I am sure setting the right autocompleteProps your requested feature might work out of the box.