Checkbox data not being submitted, even when checked.
Checkbox data not being submitted, even when checked.
Hi, I followed the instructions at https://editor.datatables.net/examples/api/checkbox.html but the value for the checkbox field is always '' (empty string). I debugged the following javascript in the browser and, this is what I saw:
...on("change", "input.editor-chosen", function() {
var row = editor.edit($(this).closest('tr'), false);
var chosen = $(this).prop( 'checked' ) ? 1 : 0;
row.set('chosen', chosen);
row.submit();
Even after the row.set()
line, row.get('chosen')
STILL returned '' (empty string).
Any ideas? TIA,
Pedro.
Answers
I solved the issue by sending a pure ajax GET request, because POST didn't submit anything. This is how I finally got it working: within the on "change" function:
The update-selected.php page just collects the data submitted, and deals with it.
I still would like to know why it wouldn't post anything using the editor, and why POST doesn't submit anything, even using pure AJAX.
Cheers,
Pedro.