Ok, now we're talking. So the question is really about a dynamic form.
If you create a row in the form with inputs that are named the same, you'll end up with a comma delimited list of value for each input. Your machine number (which might be a hidden input), the checkboxes and the date field can all by the same input name. The resulting Request("...") values would be something like this:
machine name: 1,2,3
date: 12/12/03,,15/12/03
checked: This poses a problem.
When you have multiple checkboxes with the same name on a form, only the CHECKED ones get posted, so you will have a problem here. Ok, here's a fix...
You create a row for each, there's a hidden form field that holds the machine number. This will essentially create a fixed list of numbers, one for each machine in the table. Then you create the checkbox and data inputs with DIFFERENT names that correspond with the machine number. Here's the resulting HTML I picture:
<input type="hidden" name="machineNum" value="1">
<input type="checkbox" name="checked_1">
<input type="text" name="date_1">
<input type="hidden" name="machineNum" value="2">
<input type="checkbox" name="checked_2">
<input type="text" name="date_2">
The result with will be that Request("machineNum") will look like this again: "1,2,3". You can split that into an array:
aryMachines = Split(Request("machineNum"), ",")
Now, you can just iterate through that array and call the machine specific "checked" and "date" form elements to get the data for each by constructing the request fieldname with the value from the machine name array:
For i = 0 To UBound(aryMachines)
Request("checked_" & aryMachines(i))
Request("date_" & aryMachines(i))
Next
Hope this helps.
Peter
------------------------------------------------------
Work smarter, not harder.
|