views:

3738

answers:

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?

+2  A: 
VonC
A: 

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

Diodeus
+3  A: 

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

See this demos.

CMS
+2  A: 

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>
porneL
A: 

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