Autocomplete, extraParams and this

Autocomplete, extraParams and this

Some might have seen this on google groups already, but since there is no responding, I'll give it a try in here:

Hi there, 

been searchin' for a solution for hours, hope someone here can help me 
out. 

This what I'm trying to do, I have several inputs on one page with 
autocomplete. I need to pass a variable based on the input field the 
user is in. So I decided to go with having this information as id 
value. 



I've found several solutions for autocompletes only called by the id, 
not the class, 

  $(".autocomplete").autocomplete (getAutocompleteValue.php', { 
    extraParams: { type: $(this).attr ('id') }, 
  }); 


Here is a way I found, but I can't get it to work: 

  $(".autocomplete").each (function () { 
    var field = this; 
    $(field).setOptions({ 
      extraParams: { 
        type: function() { return field.id; } 
      } 
    }); 
  }); 







By trying this, every autocomplete has the same extra params set as 
the first autocomplete. 

I think I'm just screwed up by trying for hours, so maybe someone has 
a little hint or even a solution for my? 

best olly