On 5/30/09 5:15 AM, "Adrian Grigoras" <adrianc.grigo...@gmail.com> wrote:

> I use JQuery.Autocomplete to autocomplete values into one field.
> Depending on the first field, I also need to populate a second field.
> 
> For example:
> 
> I autocomplete the Name field and depending on the selected name I
> need to autocomplete also Phone field.
> 
> It's possible to do that?

it seems so. look at the Single Bird (remote) example here:

http://jquery.bassistance.de/autocomplete/demo/

the backend returns an array with two members for each suggestion, the
members being separated by the | character. autosuggest takes the first
member for the field with autocomplete. a .result() handler takes the second
member and puts it in the other field ('Hidden input').

this rather powerful trick of passing an array back for each suggestion
seems to be undocumented. but you can see it by reading the demo source and
observing the results from, say
http://jquery.bassistance.de/autocomplete/demo/search.php?q=rob
also look in function parse(data), line 371 of the plugin:
    row = row.split("|");

presumably you can use lots of array members on each row of results.


Reply via email to