Background Information
We are using opensource code to manage widgets. One of the pages allows users to edit data in a table that has potentially hundreds of rows. For each row, it's currently populating a drop down box with hundreds of values. As you can imagine, this takes a long time and is not necessary. We won't be editing all rows at a time.
So I've been trying to tweak the code to prevent this from happening. I've changed all the drop downs in the rows to DIV tags and created a new button for them to EDIT a row.
When the user clicks on EDIT, the DIV change to a dropdown menu. So far so good. The page loads now in under a second vs over 15 minutes.
Problem
The problem is that when the user clicks on SUBMIT (for that specific row) to save their changes, the DIV field that I've been playing around with is not included in the POST data.
So specifically, the field looks like this when the page loads:
<td><div id="location_name">canada</div></td>
but after you click on an edit button and the jQuery that's triggered is done running, it looks like this (as per the F12 developer tool, and NOT view source):
<td>
<select tabindex="1" id="location_id" name="location_id">
<option value="0">-- NONE --</option>
<option value="15" style="font-weight: bold">canada</option>
<option value="16" style="font-weight: bold">usa</option>
</select>
</td>
This drop down is created by cloning an existing drop down menu when the user clicks on the EDIT button for that specific row. (I'm cloning because the existing dropdown has all the values in it that I need.)
I need the form data to include a value of "location_id=15" for the above mentioned example.
What I've checked so far:
- I've made sure that the field in question is inside the form tags.
- Alternatively, I guess I could create empty drop down controls in each row of my table...and initially set them to hidden. Then via jQuery, if the user wants to edit the row, I could change the status to visible, and somehow copy all the data from the master dropdown.
Questions
Should the form be able to 'see' fields that are created dynamically by jQuery?
If so, what else could I be doing wrong? If you want to see the full code, let me know and I will paste bin it for you.