[jQuery] jQuery autocomplete issue

[jQuery] jQuery autocomplete issue


I've been trying out the Pengoworks jquery.autocomplete, and it works
very well. I have run into one problem, though.
I have a form with numerous fields that have autocompleters. I have a
ColdFusion template that performs all of the lookups for the
autocompleters. I started by attaching distinct autocompleters one by
one to the various input and textarea controls. I used the
extraParams() option in each autocompleter to pass a "type" parameter
to my CF template so that it could return the correct lookup. This
worked fine.
I decided to go a step further and use one statement to attach an
autocompleter to all controls with a class of "acbox". OK. Then I
needed to set distinct "type" parameters for each one, so I wrote the
following script:
$(document).ready(function(){
    var ac=$("input.acbox,
textarea.acbox").autocomplete("autocomplete_queries.cfm", {
        maxItemsToShow:20 });
    for(var i=0;i<ac.length;i++){
        ac[i].autocompleter.setExtraParams({type:ac[i].id});
    }
});
The idea was that I would use each control's ID attribute as the
"type" parameter. I tested this with a form that had two controls:
id="f_post_by" and id="f_post_note". It attaches the autocompleters,
but sets the "type" attribute to "f_post_note" for both. I tried
adding an alert box in the loop to show the ids, but it shows the ids
correctly.
What am I doing wrong?
Thanks,
Carl