I'm using Material-ui Autocomplete in multiple selection mode. I want to get all the selected values on form submission. As per this Stackoverflow thread, we can get individual value on onChange event handler, but I want a simplified solution of getting all selected values on form-submission. Here is the mark-up of Autocomplete
<Autocomplete
multiple
id="checkboxes-tags-demo"
options={devicesAndGroups}
disableCloseOnSelect
getOptionLabel={(option: any) => option.name}
renderOption={(option, { selected }) => (
<React.Fragment>
<Checkbox
icon={icon}
checkedIcon={checkedIcon}
style={{ marginRight: 8 }}
checked={selected}
/>
{option.name}
</React.Fragment>
)}
style={{ width: "100%" }}
renderInput={(params) => (
<TextField
{...params}
name="selectedDevices"
variant="outlined"
label="Devices/Groups"
placeholder="Devices"
/>
)}
/>;
Is there any attribute of Autocomplete, to get all the selected values at any time?