[Autocomplete] Validate freeSolo input (with multiple) #18656
Labels
component: autocomplete
This is the name of the generic UI component, not the React module!
good first issue
Great for first contributions. Enable to learn the contribution process.
Summary 💡
Right now,
freeSolo
esp. in combination withmultiple
, is a complete freeform input.I would like to be able to run a validator before a value is added as a tag.
Examples:
This can currently achieved by
The 0 timeout makes me uncomfortable, but is necessary, since onInputChange will fire right after onChange, and will otherwise reset the input to an empty string.
I'm not sure if calling
event.preventDefault()
withinonChange
should prevent onInputChange from being triggered?Examples 🌈
Implementation of a partial match validation -
keyword
is included in several options:wat
is not in the list, and thus rejectedThe autocomplete is used as a filter here. Adding a value that doesn't at least partially match would yield no results.
This is my current implementation
Motivation 🔦
Adding validation to freeSolo multiple input.
Validation is usually not the concern of material-ui, though enabling it is by being a controlled input. I'm mostly wondering what the proper approach would be to accomplish this.
The text was updated successfully, but these errors were encountered: