Select2 - use as autocomplete text field (even if this is not an option)

I am trying to use the select2 add-in as more text field (compared to the drop-down list) with autocomplete functions. This means that if the user types something that is not in the list, I want this user value to remain as the value for the form.

I searched stackoverflow and found the following:

Disable "No matches found" text and autocomplete on select2

Select2 when there is no option, and "other" should appear

None of them retains a "custom" value.

+6
source share
2 answers

You can add the value of the search text field as an option when there is a change in the search field. In order to achieve what I said, you will have to mess up the source code as I don't see any event related to the search text field on github. http://ivaynberg.imtqy.com/select2/

If you can change your preference from the drop-down list to the check box, just check out the example named "auto tokenization" on the same page.

+2
source

All Articles