October 2nd 2006 12:15 pm

dmsAutoComplete v1.1 - ChangeLog

Recently I published an updated version of my auto-complete (Google suggest) script compatible with IE and FireFox and based on PHP/AJAX.

After publishing version 1.0, I had some feedback from people who downloaded an tested it, so now I decided to correct some of the bugs that were found, and make a few improvements also. So now I’m going to publish version 1.1, check out some of the changes I made.

FIX: Pressing TAB/ENTER with nothing selected returned an error message
Always when TAB/ENTER was pressed without any list item selected an error message was returned because the script couldn’t find the value it expected to find, this issue was resolved by adding a flag that made the script ignore this command in this case, causing it to just hide the div.

JavaScript:
  1. if (me.highlighted.id != undefined){
  2. me.acChoose(me.highlighted.id);
  3. }

CSS: FireFox showed no linebreaks
Who tried out my script in FireFox noticed that sometimes the list appeared on a single line, with no line breaks between the items, a simple change in the CSS style of the LI element resolved the problem

CSS:
  1. #acDiv UL LI{ display:block;}

FEATURE: Adding multiple auto-completes in a single page
Due to the way I was referencing the AC object in the script it was impossible to change the name of the variable that received the object. So adding more than one was an impossible mission. Adapting the reference I made it possible to add multiple scripts, as in the example:

JavaScript:
  1. var AC = new dmsAutoComplete('string','acDiv');
  2. AC.chooseFunc = function(id,label){
  3. alert(id+'-'+label);
  4. }
  5.  
  6. var AC2 = new dmsAutoComplete('string2','acDiv2');
  7. AC2.chooseFunc = function(id,label){
  8. alert(id+'-'+label);
  9. }

Version 1.1 of the script is available in the same link as before:

If you would like to know more about the scripts history look here

If you happen to find the script useful and decide to use it in your solution please let me know, give me some feedback on the bugs, and let me know how it worked for you.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votos, média: 5 de 5)
Loading ... Loading ...

4 Comments »

4 Responses to “dmsAutoComplete v1.1 - ChangeLog”

  1. santosh on 20 Dec 2006 at 6:54 #

    dmsAutoComplete v1.1 - ChangeLog

    short out this error…
    using Mozilla firefox

    Error: uncaught exception: [Exception... "Component returned failure code: 0x804b000f [nsIXMLHttpRequest.setRequestHeader]” nsresult: “0×804b000f ()” location: “JS frame :: http://www.rafaeldohms.com.br/myprojects/autocomplete/dmsAutoComplete.js :: anonymous :: line 187″ data: no]

  2. Eder on 23 Apr 2007 at 15:02 #

    Ao pressionar as teclas UP/DOWN sem ter iniciado a busca, ocorrem vários erros no javascript.

  3. Jon B on 13 May 2007 at 21:09 #

    I love your script, but I cannot get it to work on my site. I don’t get any error messages, but the drop-down box never gets populated with any items. The example on your site works fine for me. I am using PHP 5, and I’ve set permissions for your files to 755. Any thoughts on what I might try? My example page is here:
    http://scripts.mit.edu/~jonb/dmsAutoComplete/example.htm

    Thanks!

  4. Jon B on 17 May 2007 at 8:33 #

    OK, I was able to get your script to work on a different server, but I really need to get it to work on my own. My server is running PHP Version 5.1.6, while the server on which I got it to work is running Version 5.2.1-0.dotdeb.2. Should this make a difference as to whether your script will work? Are there any other environmental variables I should be checking?

Trackback URI | Comments RSS

Leave a Reply

« Using User-Defined Varibles in MySQL | AJAX: What is it? »