5

I have a page where my combo box has hundreds of elements which makes it very hard to pick the one item I want. Is there a good Javascript replacement that would do better than

<select id="field-component" name="field_component"> 
                  <option selected="selected">1</option><option>2</option>...
</select>

Is there something with "Intellisense"-like auto-complete?

Epaga
  • 38,231
  • 58
  • 157
  • 245

7 Answers7

6

In HTML 5 there's standard combo box.

Currently only Opera supports it, but if you happen to be time traveller or writing Opera-only application, it's a nice solution :)

<input type=text list=listid>
<datalist id=listid>
  <select><option>1<option>2</select>
</datalist>
Kornel
  • 97,764
  • 37
  • 219
  • 309
3

http://www.dhtmlx.com/images/logo_combo.gif
You have dhtmlCombo, using ajax to retrieve data when you are filling the input field.

dhtmlxCombo is a cross-browser JavaScript combobox with autocomplete feature.

It extends basic selectbox functionality to meet the requirements of the most up-to-date web applications.

dhtmlxCombo can be converted from existing HTML SELECT or populated with JavaScript. Supporting AJAX, it can also get list values from the server datasource dynamically.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

Check the jQuery Autocomplete plugin, it's easy to use, you only have to generate a JSON response server side.

See this demos.

Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838
0

You can try this combobox realization http://www.zoonman.com/projects/combobox/

  • Pure JavaScript. Editable. Supports IE6.
  • Nonstandard HTML layout.
zoonman
  • 1,116
  • 1
  • 12
  • 30
0

I think Twitter's free typeahead.js library is the best autocomplete library available today. Check it out at http://twitter.github.io/typeahead.js/

David Schwartz
  • 1,956
  • 19
  • 28
0

The autocompleter using Prototype and Scriptaculous works well in this situation.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
0

Just a note: If the select box is current focused, you can type on your keyboard and it will take you to the selection beginning with that text, so typing "k-e-n" into a US State dropdown would auto-select the "Kentucky" option.

Jared Farrish
  • 48,585
  • 17
  • 95
  • 104