jQuery autocomplete on multiple fields

Posted by Onigoetz on Stack Overflow See other posts from Stack Overflow or by Onigoetz
Published on 2010-05-17T14:35:33Z Indexed on 2010/05/17 14:40 UTC
Read the original article Hit count: 239

Filed under:
|
|

Hi all,

Surprisingly, I didn't find any answers to my question.

I want to make a form on jQuery with two fields.

  1. City Code.
  2. City Name.

and when I enter a city code and go out of the field. I want an autocomplete on the city name.

I Installed the jQuery Autocomplete plugin.

and I have the following code :

$(document).ready(function() {
    $("#field_localite").autocomplete('admin/ajax/npa', {
       extraParams: {
           npa: function() { return $("#field_npa").val(); }
       }
    });

    $("#field_npa").blur(function() {
        $("#field_localite").search();
    });
});

The problem is that the .search() method. doesnt launch the autocomplete.

I'm looking for a method to trigger this autocomplete search on the field.

do you know a way or a plugin able to do this search ?

thanks in advance

BTW : the PHP code behin is totally tested and works, it returns the data when doing the call.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-autocomplete