Hello, everyone,
I’m in need of some advice on processing data from a particular part of a form that I am working on. The SS dev language that I’m working in (anyone who knows me already knows) is ColdFusion.
One part of this form is being dynamically created on page load, and the number of form fields can be changed by the user via a SELECT; there can be anywhere from 0 to 25 of these form fields (actually pairs of form fields - one text input and one select.)
Since the number of form fields can vary, I originally wanted to set it so that each text input had the same name (ditto for the selects) so that the value would be a comma-delimited list of values (if more than 1). In the interest of brevity, I won’t go into any detail as to why that is not going to be the case.
Now I have it set so that whenever the user changes the value from the 0-25 SELECT, each text input field will have a name like “NAScode_x” where ‘x’ is the iterative index (ie, NAScode_00, NAScode_01, NAScode_02, etc.)
My request for advice is on the back-end, after the form is submit (via AJaX). How to go about inserting the data into the database.
There are several tables that will get data from different parts of the form. Since most of it is hard-coded, most of it will be easy. The question is: what is the best practice for inserting the data from the dynamically created pairs of elements. One form could have one, another could have 20, another could have none. How would you go about processing that data?
V/r,