Reputation: 107
I am trying to implement checkbox to submit as form but I realized it will not work this way. What is the correct way to implement this? I read some example here but couldn't understand.
<form method="post" name="search_form" action="<?php echo $linksearch; ?>">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="search_table">
<thead>
<tr>
<th>Process1</th>
<th>Process2</th>
<th>Process3</th>
<th>Process4</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$sql = "select * from activity_temp";
$result=tep_db_query($sql);
$sc=0;
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>".$row['p1']."</td>";
echo "<td>".$row['p2']."</td>";
echo "<td>".$row['p3']."</td>";
echo "<td>".$row['p4']."</td>";
echo "<td class=\"center\"><input type=\"checkbox\" name=\"search_cb[".$row['temp_id']."]\" value=\"on\"></td>";
echo "</tr>";
$sc++;
}
?>
</tbody>
<tfoot>
<tr><td colspan="5" align="right">
<input id="search_form_submit" type="submit" name="submit" value="Search" class="submit" />
</td></tr>
</tfoot>
</table>
</form>
Do I do this?
$('#search_table').dataTable({
"aoColumnDefs": [{
"bSortable": false, "aTargets": [4]
}],
"aoColumns": [
{ "mDataProp": "checkBox" }],
"aaData": [{
"checkBox": "<input type="checkbox" name="search_cb" value="on" />"
}]
});
Upvotes: 1
Views: 1483
Reputation: 11
$('#form').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
Source: http://datatables.net/examples/api/form.html
Upvotes: 1