It's a great code. However, something is missing to be perfect . It would be great to have a feature for customization of the number of characters that start the auto-complete control, i.e after the 3rd wrote character.
Any quick easy way to get the code to work in Safari as well? Thanks! It's an awesome script! I'm using it for our free medical clinics to help ease our data entry.
Great code... works very well. However, immediately I found that I couldn't tab around forms like I'm used to doing. That is to say, when in a field that is using the functionality, I cannot tab out of it. It seems that when the tab key is pressed, we need to look at the previous character. If that character is the start of the field, a space, or a delimiter, then the tab should act normally by advancing the cursor to the next form field.
I found the need to warn users when they were attempting to enter data that was not in the drop down list. To do this I simply change the text color in the <INPUT> box when no matches are found.
INSTRUCTIONS:
In function "actb_generate()", replace lines 2-5 with the following code.
This was the quick and dirty solution. A more complete method would be to move the actual color values up into the area where the style variables are set for the drop down. ...but I figured the simple example was easiest to convey.
I am using this to sort through lists of a couple thousand items and it is MUCH better than simply asking a user to scroll through a huge <SELECT> box. ...Thanks a bunch!
This is a great piece of code! Works very quickly and reliably, even when it has to call my clunky code everytime it fills a text box!
I was wondering however, if you could tell me how to display a complete list? i.e. when the user types in a '*' or some other special character, the entire array which is passed to actb() is displayed?
I'd appreciate it if you could give me a hint on how to do that, or point to a place in your code that could help me start.
In case anyone is interested, entering a period "." into an autocomplete text box allows one to view the entire list!
This should probably be documented in the article, as I spent quite a bit of time writing additional methods to handle this functionality, only to discover it was already present!
Hi,
nice work and really fast... Thanks'
Is there a way where I can return (retrive) the index of the choosen element in my custom array...Since I am not using the entries in the array direclty?
Any idea pelase!
this code is nice.but if this code can get data from database with xml it coluld be nicer.when i key pressed any key on textbox data must be updated.How can i do this.or is it imposssible ?
Can I include this in a project that is under the GNU General Public License (a.k.a. GPL)?
I read the "Creative Commons" and it is a little different (for example, it allows commercial use, but the GPL does not). However, it also says any rights can be waived or granted by the copyright holder.
Thanks so much for your friendly contributions. Indeed, we now use (and credit) this code in a non-GPL project we run, http://movielens.umn.edu (in the "Advanced Search" for other languages).
I read up on licensing, and here's what I found out. We cannot use it with a GPL project unless it is released under a GPL-compatible license. See http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses for more information on compatible software licenses.
Also, the creative commons discourages using their licenses for software, as they are designed for content, not software. See http://creativecommons.org/faq#faq_entry_3646
Sorry for all this licensing crap. I wish it weren't a problem, too.
I need this for email format. I tried to put
var customarray=new Array('Tom <tom@tom.com>', 'Tom <tom@tom.com>');
First one, it won't show the email address in drop menu but it will show in the text box.
2nd one, it shows in drop menu but < > is not showing properly in text box.
Also, i need to auto add the common , at the end when select.
[Edited] I got it working now for email.
line 58: var actb_delimiter = new Array(', ');
and
line 400: actb_curr.value = str.replace(/& lt;/gi, "<").replace(/& gt;/gi, ">") + ", ";
Wow.. this is a great tool. Thanks for the effort.
Now, the one issue that I currently have is with escaping of < and > characters. I can make them show up in the drop down list correctly, or be transfered back to the input field correctly, but not both.