dynamically adding a field and submitting new field to server
dynamically adding a field and submitting new field to server
Hello,
I am working on a contact management solution and need to have the ability to dynamically add input fields to capture contact information for multiple people. At the time the form is initialized I can only assume there will be at least one contact, but I do not know if there are 2 or 10 more contacts my users would like to enter. From a UI perspective, when the user starts typing in contact information, I am able to use editor add()
to add a new field for the second contact, third etc. However when the data is submitted to the server, the dynamically created fields do not show in the JSON string.
I assume it is because the newly created fields have been added to the UI but editor object is unaware of them.
Any thoughts or ideas? I would assume the editor add()
function would add it to the UI and the data object.
This question has an accepted answers - jump to answer
Answers
add()
added fields should indeed be included included in the submitted data.On this page if you open a browser console and enter:
it will add a form element dynamically to the form. Click submit and it submits it:
Can you link to a test page showing the issue please?
Allan
Thanks for the quick answer Allan. I set up a testing server that I am happy to share, but in doing so I realized very quickly that I was looking at the response from the server after adding the record and not what was submitted. It looks like the add() function is working as expected.
In any case, it forced me to set up a QA environment which was desperately needed. Thanks again for the great support and software.
No problem - good to hear that helped .
Allan