Multiple autocomplete select fields with same data source
Multiple autocomplete select fields with same data source
Good afternoon
In my editor form I want to extend the number of categories a product can belong to....
Currently using this snippet for autocomplete:
{
label: "Kategorie",
name: "category",
type: "autoComplete",
opts: {
select: function (event, ui) {
event.preventDefault();
$(this).val(ui.item.label);
editor.val('cat', ui.item.value);
}
},
},
{
label: "cat",
name: "cat",
type: "hidden"
},
The selectable categories are feed from a returned json in the array "cat"....
Now if I want two more autocomplete select inputs, how can I use the same json data "cat" as selectable inputs?
Only way I see now is duplicate the category input and the hidden categories with category2/cat2, category3/cat3 and so on...
If I just use "cat" for all categories the POST request is made with the category names instead of the category ids:
data[0][category]: Wohnen - Dekoration - Allerlei
data[0][category2]: Wohnen - Ordnung - Kisten
data[0][category3]: Garten & Balkon - Bepflanzen - Kisten
thanks in advance
richard
Answers
Sounds like you might want to use jQuery UI AutoComplete's
multiple
option?I'll be honest, that control and I don't really get along too well - I find its value / label handling really difficult.
Allan