Hello there!
I have a simple form, buttons are not functional yet with the exception of "Add a Dependant Item" button:
When the "Add a Dependant Item" button is clicked, the form is being changed, such that there is an additional field for a dependant item:
So far, so good...
The idea is that every time the "Add a Dependant Item" button is clicked, the form will have an additional field for another dependant item. How do I go about this in JavaScript without sending the form to the server? I assume I must use variables, that keep count of the number of the fields for dependant items, i.e. how many times the "Add a Dependant Item" button has been clicked, but I don't know how. Also, if I already filled in some other fields in the form, and suddenly I decide that I want to add another dependant item, I would like the filled-in data not to disappear just because I'm adding another field to the form.
Things get a little trickier when you take into account the "Add Another Item" button and its purpose, but the question is the same. Say, I'm done with the first item and its dependant items, filled in all the pertinent data, then I decide that I would like to add another item. Naturally, I would like the filled-in data not to disappear, while I keep on adding new items.
The form will only be sent to the server when the "Save Category and Upload Items" button is clicked.
Thanks for your time and insights!
Csanád
I have a simple form, buttons are not functional yet with the exception of "Add a Dependant Item" button:
When the "Add a Dependant Item" button is clicked, the form is being changed, such that there is an additional field for a dependant item:
So far, so good...
The idea is that every time the "Add a Dependant Item" button is clicked, the form will have an additional field for another dependant item. How do I go about this in JavaScript without sending the form to the server? I assume I must use variables, that keep count of the number of the fields for dependant items, i.e. how many times the "Add a Dependant Item" button has been clicked, but I don't know how. Also, if I already filled in some other fields in the form, and suddenly I decide that I want to add another dependant item, I would like the filled-in data not to disappear just because I'm adding another field to the form.
Things get a little trickier when you take into account the "Add Another Item" button and its purpose, but the question is the same. Say, I'm done with the first item and its dependant items, filled in all the pertinent data, then I decide that I would like to add another item. Naturally, I would like the filled-in data not to disappear, while I keep on adding new items.
The form will only be sent to the server when the "Save Category and Upload Items" button is clicked.
Thanks for your time and insights!
Csanád