Monday, 9 September 2013

Adding POST data to dynamically created fields, when only 1 field is shown by default

Adding POST data to dynamically created fields, when only 1 field is shown
by default

The live version of this is shown on www.cfiresim.com.
On that page, I have 2 sections "Income/Savings/SS/Pension" and "Spending
Inputs" which have a button that dynamically create more form inputs if
the user needs them.
If you successfully run my page, the output page will show a big
serialized string of what the POST variables are, so that you can
theoretically use that data in the future. Unfortunately, because of how
many possible form entries I have, GET is not an option here.
I'm trying to implement a way to paste that test string in the input form,
and have all of the fields become populated with the information
represented in that serialized string. For most things on the form, it's
easy. However, I'm at a loss as to how to accomplish this on form inputs
that are dynamically created.
Example: If I enter data in the first "Spending Input" section, and click
the "Add Another Spending Input", another form will be generated and that
data will be POSTed to the serialized string. However, if I want to recall
that data and actually show that 2nd Spending Input on the page, what do I
do? By default, the page only shows 1 input.

No comments:

Post a Comment