Datatable - Forms and checkboxes
Datatable - Forms and checkboxes
catoha
Posts: 5Questions: 0Answers: 0
Hi.
I'm trying to implement the plugin: http://www.datatables.net/examples/api/form.html
It looks to me working quite well on the form side. I can check the boxes and when I press submit the dialog tells me that the checkboxes on different pages (paginator) have been selected. The forms sends the user to another page where the checkboxes are collected.
This does not work.
The datatable code:
[code]
var oTable;
$(document).ready(function() {
$('#custom').submit( function() {
var sData = oTable.$('input').serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return true;
} );
oTable = $('#deltakere2').dataTable( {
"aaSorting": [[ 0, "desc" ]]
} );
} );
[/code]
Parts of the code on the destination page. Please note that my checkboxes have names from 1-94 (collected from user IDs) So on the destination page I go through every checkbox to see if it's checked.
I'm not getting this to work, so I'm wondering if someone can help me with collecting the selected checkboxes so that I can update the sql accordingly.
[code]
if($_POST) {
for($i=1;$i<$syklistID;$i++){
if(isset($_REQUEST['checkbox'+$i])){
echo $i;
mysql_query("INSERT INTO mck_syklist_pa_tur (sptSyklistID, sptTurID)
VALUES ('$i', '$turID')");
}
}
}
[/code]
Kind regards,
Cato
I'm trying to implement the plugin: http://www.datatables.net/examples/api/form.html
It looks to me working quite well on the form side. I can check the boxes and when I press submit the dialog tells me that the checkboxes on different pages (paginator) have been selected. The forms sends the user to another page where the checkboxes are collected.
This does not work.
The datatable code:
[code]
var oTable;
$(document).ready(function() {
$('#custom').submit( function() {
var sData = oTable.$('input').serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return true;
} );
oTable = $('#deltakere2').dataTable( {
"aaSorting": [[ 0, "desc" ]]
} );
} );
[/code]
Parts of the code on the destination page. Please note that my checkboxes have names from 1-94 (collected from user IDs) So on the destination page I go through every checkbox to see if it's checked.
I'm not getting this to work, so I'm wondering if someone can help me with collecting the selected checkboxes so that I can update the sql accordingly.
[code]
if($_POST) {
for($i=1;$i<$syklistID;$i++){
if(isset($_REQUEST['checkbox'+$i])){
echo $i;
mysql_query("INSERT INTO mck_syklist_pa_tur (sptSyklistID, sptTurID)
VALUES ('$i', '$turID')");
}
}
}
[/code]
Kind regards,
Cato
This discussion has been closed.