it works fine,but the problem whenever i type a word.. and then press enter it automatically takes the closest autosugessted word from the list ...for example
1.the list contains the word "an apple"..so when ever i type "app" in the textbox and then press enter ..it takes the word "an apple" from the autosugessted list .
example 2..if i type "king"..and then press enter it automatically takes "kingbird"..
hence can any one solve it ?
actually i am looking for this solution :
it should only take the word from autosugesstion list if selected from arrow key or mouse
other wise it should take word from textbox which is typed by user
I downloaded your Auto-complete code sample from "http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=8020&av=41368" to implement an on-line translator. I would like to know how to implement auto-complete control with external js file?
Within function actb_checkkey(), the switch() statement checks for the Up, Down, Enter and Tab keys. If you add one more case statement, you can allow the user to hide/cancel the displaying list:
If this is added before the final default:, no other code is needed, and you can start typing your text in the autocomplete form, hit ESC, and the suggestion box disappears.
One suggested given for this code is to create a new instance of actb(). If you want to modify the array after it has been saved, be sure to capture the returned object:
var customarray_description = new Array();
var obj_description_school = new actb(document.getElementById('school'), customarray_description);
var customarray_code = new Array();
var obj_code_school = new actb(document.getElementById('school'), customarray_code);
obj_description_school.actb_keywords = a_different_customarray_description;
...
Changing the color hides the dropdown highlighting, but what I am seeking is something different.
If my list was populated with "Item1", "Item2", "Item3", and I type in "Item" then press [Enter], the script Automatically auto-completes the text in the textbox to become "Item1", as "Item1" gets highlighted BY Default (AS it is the first entry in the list).
I would like to perform a search for "Item". So I would like to type in "Item" then [Enter], without automatically selecting the first highlighted item in the list, in this case "Item1" gets selected and the action is performed.
Pretty much, how can I Modify the script SUCH that NO items are selected by default. I think this would solve my issue.
Last Visit: 31-Dec-99 18:00 Last Update: 22-Sep-24 22:38