I've got a form. In this form, a user can fill out a few fields, then click "Add". The data gets turned into an HTML element, and then the form gets (partially) cleared so that he can type some more data.
I'm trying to figure out how to store that data when he clicks "Add" so that it can be submitted later. Should I serialize (JSON? or is there a more compact representation--doesn't need to be human readable) it and store it in a hidden field? If so, what happens when he adds a 2nd object? I deserialize the old data, and then reserialize the 2 objects together? Seems inefficient.
Do I somehow clone the form, hide it, and update all the name
attributes so they don't conflict, and then kill myself trying to parse these stupid things into an array later?
What's the best approach?