Closed ShingYYY closed 1 month ago
You'll need to make a plugin that creates multiple input[type=text] or textarea's with the name set with a [] at the end in the build stage. formBuilder will save the results as an array out of the box ["A","B","C"]
To do your object return you should look at creating an extra hidden input with your name and then don't set a name on the text inputs. Then have a change handler set to update the hidden input with the json encoded object. formBuilder will then pickup the hidden input only. ["{...}"]
Thank you for your advice. It inspires me a lot.
How to custom multiple input in one field and set JSON output is array or object?
seem like this:![image](https://github.com/user-attachments/assets/91c409f1-6812-4025-a0e5-57f8f0013573)
And then JSON output Can be array: { "answers": [ "A", "B", "C" ] }
Can be object: { "answers": { "answer_1": "A", "answer_2": "B", "answer_3": "C" } }
In addition, I am very grateful to the developer who created formBuilder. It helped me solve 70% of the problems. Thank you.