I have a form that loads a table from a database query using custom code. The only element on the form in design mode is a Submit button. I want to have a checkbox in each row of the table, to allow the user to select one or more rows to perform some action. I add the checkboxes as I load the table, naming them cbox[0], cbox[1], etc., and they appear on the form when it's loaded, but I don't know how to get the values into the $form array so that in my On Submit custom code I can determine which rows have been selected. Can anybody tell me what I'm missing here?
Hi nlheath,
If the HTML is valid then they should automatically be added to the $form->data array. What do you see in the Debugger when you add it?
Bob
If the HTML is valid then they should automatically be added to the $form->data array. What do you see in the Debugger when you add it?
Bob
The debugger in the OnLoad shows an empty array - [cbox] =>
I click the boxes in the first 5 rows and click Submit.
In OnSubmit, if I don't use DataToSession and SessionToData, [cbox] is not listed at all.
If I use DataToSession and SessionToData, it shows as [cbox] =>
I click the boxes in the first 5 rows and click Submit.
In OnSubmit, if I don't use DataToSession and SessionToData, [cbox] is not listed at all.
If I use DataToSession and SessionToData, it shows as [cbox] =>
Hi nlheath,
Then I'd guess that your checkboxes aren't inside the <form> </form> tags - or aren't valid HTML ???
Please post a link to the form so I can take a quick look.
Bob
Then I'd guess that your checkboxes aren't inside the <form> </form> tags - or aren't valid HTML ???
Please post a link to the form so I can take a quick look.
Bob
Here's the code for the checkboxes:
<td>
<input type="checkbox" name="cbox[<?php echo $rowx; ?>]" value="0">
</td>
The cbox array was showing in the debugger only because I had a statement adding it to the $form->data array. When I remove that statement it no longer appears in either debugger.
<td>
<input type="checkbox" name="cbox[<?php echo $rowx; ?>]" value="0">
</td>
The cbox array was showing in the debugger only because I had a statement adding it to the $form->data array. When I remove that statement it no longer appears in either debugger.
Here is a link to the form:
http://www.bucksgen.org/index.php/component/chronoforms?chronoform=BCGSMemberSelectTest&action=&EM
http://www.bucksgen.org/index.php/component/chronoforms?chronoform=BCGSMemberSelectTest&action=&EM
This topic is locked and no more replies can be posted.