hi all,
I would like create a dynamic html page where if a user push ADD button a new line of text field is added and then when he submit, all the text field return to backend in order to save data in jsonfield in the form {‘field1’:value1, ‘field2’:value2…}
it is possible?
many thanks in advance
Yes, it can be done with some JavaScript.
many thanks Ken, do you have some example just as tutorial? I’m trying find something on internet but without success
Personally? No.
The specifics for this would depend on what (if any) JavaScript framework you’re using. That should help guide your search. (Doing this with jQuery, for example, would be far different from doing it with, say, React.)
You can scan the forum here for people who have posted code to add forms for formsets - that may be close enough to give you an idea of what needs to be done to add the field. (The key differences would be that they’re adding an entire form and also needing to make changes to the management form, where your case would be a lot easier.)