Disable default selection on 'autocomplete' mform element? (single select)

Re: Disable default selection on 'autocomplete' mform element? (single select)

by Mitxel Moriana -
Number of replies: 0

I have a strong feeling that this issue is related to the fact that the browser marks as selected the first element of any "single-value" selector, then the autocomplete module just "inherits" this first option marked as selected. A fix/hack is theoretically possible by modifying the autocomplete module (form-autocomplete) initialization like so (not tested):

Check original select is not multiple (it is single), if so then check no option was really marked (yet), if so then prepend dummy empty option (<option></option>) to the underlying selector and mark it as selected (...prop('selected', true)), then prevent the autocomplete to add this item (as the selected one) if it is a dummy/empty item (at updateSelectionList method).