At now Select2 autocomplete widget need to type at least one symbol for show field autocomplete results. But in many situations users don't know what to type in form field, and good to show top of available options to user via simple mouse click on field, without any typing. Replacing autocomplete to select is bad idea, when select contain 1000+ options. #3081956: Allow showing autocomplete results for Drupal fields with empty input string is similar feature request for Drupal code.
So will be good to add configuration of minimum length for autocomplete results (for allowing autocomplete only with 2 or 3 characters too), and allow zero values for show variants immediately on click event.
Will be good to make this configurable in field settings.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | select2_3083898_autocomplete-empty.patch | 1.37 KB | murz |
Comments
Comment #2
murzHere is the patch, that hard-code zero minimum length for autocomplete, and allow empty
qin EntityAutocompleteController ajax response.Comment #3
murzComment #4
murzComment #5
murzComment #6
chr.fritschI added a PR to allow empty inputs for autocomplete. https://github.com/thunder/select2/pull/72
I don't want to make this configurable because select2 supports so much different configs, it's impossible to make it configurable for everything.
But now you can now easily override that property.
Comment #7
murzThanks for PR, it works well! About configuration - yes, configuration in UI is not very needed, overriding property in backend is enough.
Comment #9
chr.fritschDone. Thank you