Submitting forms with pagination
Submitting forms with pagination
TheGrudge
Posts: 9Questions: 0Answers: 0
Hi,
I know the examples for sending forms with serialize(), e.g. described on this page:
http://www.datatables.net/examples/api/form.html
But I am not able to send all elements in a form. My code looks like this:
[code]$('#myform').submit( function() {
var sData = $(':checkbox', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return true;
}); [/code]
But I only see the first two selected checkboxes in my GET string:
[quote]file:///home/andi/downloads/DataTables-1.9.4/DataTables-1.9.4/untitled.html?example_length=10&lala=on&lala3=on[/quote]
The value "lala2=on" is missing in my case.
Do I need to submit the values myself somehow? The alert box shows all entries, only the GET string is missing everything that is not on the first pagination page.
Thanks for your help, I'm new to Javascript and jQuery, so maybe this is a stupid question for some of you :-)
Andi
I know the examples for sending forms with serialize(), e.g. described on this page:
http://www.datatables.net/examples/api/form.html
But I am not able to send all elements in a form. My code looks like this:
[code]$('#myform').submit( function() {
var sData = $(':checkbox', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return true;
}); [/code]
But I only see the first two selected checkboxes in my GET string:
[quote]file:///home/andi/downloads/DataTables-1.9.4/DataTables-1.9.4/untitled.html?example_length=10&lala=on&lala3=on[/quote]
The value "lala2=on" is missing in my case.
Do I need to submit the values myself somehow? The alert box shows all entries, only the GET string is missing everything that is not on the first pagination page.
Thanks for your help, I'm new to Javascript and jQuery, so maybe this is a stupid question for some of you :-)
Andi
This discussion has been closed.
Replies
Allan
I test my javascript "select all" method with the following html table:
http://pastebin.com/dcjqvWUx
The goal of the "select all" function is to select all data rows if no filter is selected, otherwise select the filtered rows. This works well, but now I need to submit the form and only the values in the first page are sent.
I test it as follows: Press "All", then "Submit". The dialog box displays all variables, but the GET parameters in the browser show only the parameters from the first page.
Allan
Example:
http://pastebin.com/uqE6MQif
The page isn't refreshed as well, so I guess the GET request isn't send. Even if I change the url in $.ajax to a different website (e.g. google.com), the browser doesn't show the page the data is sent to (normally I would see the google website now?).
Andi
[code]oTable.fnDestroy();
return true;[/code]
in the submit callback handler. But this doesn't look good because the table is displayed as a normal HTML table again, before the POST is actually redirected to the new page.
I'd suggest making a valid $.ajax - probably using an object with the properties set, as shown in the jQuery document and seeing if that helps.
Allan
[code]
var request = $.ajax({
url: "",
type: "GET",
data: sData
});
return false;
[/code]
It doesn't work, the page isn't refreshed and therefore the application where we use datatables is not able to call the appropriate action. The "request" object is created and no error is thrown. The only way it seems to work is by destroying the datatable in the submit callback.