Submitting form with field on hidden page
Submitting form with field on hidden page
DataHead
Posts: 1Questions: 0Answers: 0
Hi,
Thank you for this great ressource.
I know it has been discuss before on this forum (here: http://datatables.net/forums/discussion/185/submitting-forms-with-fields-on-hidden-pages/p1) but the proposed solutions do not work in my hands.
I have a DataTable with pagination enable and check boxes on every row that user can select. At the bottom of the page I also have a "select all on this page" button.
Problem: The form only submit the active DataTable page. I have a solution working with GET (it pass multiple page etc...) request but I cannot get the POST to work. I need to switch to POST because of many things among one is that the URI become too long.
The table is included in a form
[code]
<?php
echo '';
include 'displayTableBrowse.php'; // display the table rows etc...
echo "
Select all on this page
";
echo "
Submit selection...
";
echo '';
[/code]
The javascript look like that
[code]
<!-- loading libraries -->
<!-- select all function -->
function toggle(source) {
checkboxes = document.getElementsByName('check_list[]');
for(var i in checkboxes)
checkboxes[i].checked = source.checked;
}
var oTable;
// This works. It does GET ( you have to replace the method value in the php script above)
// $(document).ready(function() {
// $('#form_browse').submit( function() {
// var sData = $('input', oTable.fnGetNodes()).serialize() + "&formSubmit=true";
// // alert('The server said ' + sData);
// location.href = 'selection.php?'+ sData;
//
// return false; // We do want the page to refresh
// } );
//
// oTable = $('#table_browse').dataTable();
// } );
// This only post the active page.
$(document).ready(function() {
$("form#form_browse").submit( function(){
e.preventDefault(); // preventing default click action
var sData = $('input', oTable.fnGetNodes()).serialize(); // using fnGetHiddenNodes change nothing
return false;
});
oTable = $('#table_browse').dataTable();
} );
[/code]
Thank you for this great ressource.
I know it has been discuss before on this forum (here: http://datatables.net/forums/discussion/185/submitting-forms-with-fields-on-hidden-pages/p1) but the proposed solutions do not work in my hands.
I have a DataTable with pagination enable and check boxes on every row that user can select. At the bottom of the page I also have a "select all on this page" button.
Problem: The form only submit the active DataTable page. I have a solution working with GET (it pass multiple page etc...) request but I cannot get the POST to work. I need to switch to POST because of many things among one is that the URI become too long.
The table is included in a form
[code]
<?php
echo '';
include 'displayTableBrowse.php'; // display the table rows etc...
echo "
Select all on this page
";
echo "
Submit selection...
";
echo '';
[/code]
The javascript look like that
[code]
<!-- loading libraries -->
<!-- select all function -->
function toggle(source) {
checkboxes = document.getElementsByName('check_list[]');
for(var i in checkboxes)
checkboxes[i].checked = source.checked;
}
var oTable;
// This works. It does GET ( you have to replace the method value in the php script above)
// $(document).ready(function() {
// $('#form_browse').submit( function() {
// var sData = $('input', oTable.fnGetNodes()).serialize() + "&formSubmit=true";
// // alert('The server said ' + sData);
// location.href = 'selection.php?'+ sData;
//
// return false; // We do want the page to refresh
// } );
//
// oTable = $('#table_browse').dataTable();
// } );
// This only post the active page.
$(document).ready(function() {
$("form#form_browse").submit( function(){
e.preventDefault(); // preventing default click action
var sData = $('input', oTable.fnGetNodes()).serialize(); // using fnGetHiddenNodes change nothing
return false;
});
oTable = $('#table_browse').dataTable();
} );
[/code]
This discussion has been closed.