olly
2010-03-03 15:32:48 UTC
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
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