3
votes

I'm using jQuery's autocomplete feature. The user enters a college name, and autocomplete feature shows the list of similar colleges that he/she entered. It works fine. The only problem is that I want to disable the user from entering any other college apart from those that are shown in the drop-down autocomplete menu. I mean, I want to make the user choose, from the available list, he/she cannot enter any other text in the field. He will enter some text, for which autocomplete will display the results, and then choose from that list. Currently, the user is able to enter a search string, choose from the results and then modify the field. I don't want that.

How can I do that? Currently, the relevant html is:

<div class="ui-widget txt-fld">
   <label class="labelname">College:</label>
   <input id="college" class="textinput" name="college" />
</div>
2
This looks similar to what you want. jqueryui.com/autocomplete/#combobox - Danny

2 Answers

2
votes

I know one universal select which helped me over and over again. Look at this:

http://ivaynberg.github.com/select2/

maybe it helps you.

0
votes

You want a searchable select list (or searchable dropdown). If you don't allow modification it really can't be considered an autocomplete anymore.

The following plugin would work for you.

http://jsearchdropdown.sourceforge.net/