Multiple autocomplete select fields with same data source

Multiple autocomplete select fields with same data source

klinglerklingler Posts: 90Questions: 42Answers: 2
edited February 2022 in Editor

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) {
                    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


Sign In or Register to comment.