Code Library/ComboBox
Find and manipulate database content with AJAX
If a select box contains many values from a database table it is often not acceptable to display them all. Either it may take a long time until the user will find the entries he is searching for or the load on the database or network might be too high. In this cases the ComboBox can ease your pain by dynamically retrieving entries based on the string the user has entered.
Example
Type in one or more characters and click on the magnifying glass. The combobox will contain all matches which contains the string:
The ComboBox won't ask the server while you're typing because this may cause performance problems sooner or later. If you have many visitors using this functionality at the same time, it would generate a high load on your database server because of the requests sent to the server after typing in a character each time.
The edit, add and delete buttons will give you an impression of what is possible. Due to the stateless nature of the script behind (the entires won't be stored in a database or something like that) the changes are lost as soon as the list is reloaded by an action.
Code
The ComboBox code is based on the Prototype library and you need both to get it to work.
License
The ComboBox code is freely available and distributeable under the terms of the BSD license. You can use it in any project (even comercial ones) as long as you list the authors of the ComboBox.
The icons used above are part of the KDE Crystal Theme. Thanks to the KDE Artists for this nice piece of work.