On 4/16/09 6:44 PM, "tatlar" <robertlnew...@gmail.com> wrote:

> So, I got around this by creating another JSON file that is just an
> array of station names. Autocomplete now parses this just fine, and my
> first field is completed. The next part was more tricky - how to
> populate the second input field based on the number of report types (I
> actually ended up using a <select> element with the <option> list
> populated with the reports available. My solution is pretty inelegant,
> but uses a nice option in Jorns plugin, the result() option (http://
> docs.jquery.com/Plugins/Autocomplete/result#handler). Using this, I
> can get the match from the first autocomplete call, and write a
> callback function that then goes via AJAX to my original complex JSON
> object to just get the matching stations object.

so in the end you used only a simple autocomplete and circumvented the
issues of handling automatic pre-stuffing of multiple dependent autocomplete
fields with your ajax-stuffed select element.

if it works, it works. since this isn't the kind of solution i'm interested
in, i only briefly read your code to see how you did it. you've avoided
solving the problems i'm interested in.

i have one comment on the code: you embedded an ajax query inside the
.result() handler of an .autocomplete(). this works if users move in one
direction through the form, which, in your case, is from autocompleting text
field to the select. this is something i wanted to avoid; i need a
non-hierarchical ui. the user has three text fields and can start typing in
any of them and then move from there to either of the other two text fields,
and when he or she does, the autocomplete list appears on focus constrained
by the entries already selected.


Reply via email to