Bug 35648: (follow-up) Clear table filter before submitting

This patch takes advise from elasticsearch-mappings.js and adds an
onsubmit event to clear any DataTables filter before submitting. This
should prevent hidden fields from being overwritten.

To test, filter the table and make a change to one of the visible rows.
After submitting, confirm that the previously-hidden rows retain the
same settings as before.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2024-03-22 12:47:22 +00:00 committed by Katrin Fischer
parent 2800f7c9fb
commit 109a1e93dc
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 7 additions and 1 deletions

View File

@ -67,7 +67,7 @@
</div>
[% END %]
[% IF ( table ) %]
<form method="post" action="/cgi-bin/koha/tools/overduerules.pl">
<form method="post" id="overduerulesf" action="/cgi-bin/koha/tools/overduerules.pl">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-save" />
<input type="hidden" name="branch" value="[% branch | html %]" />
@ -198,6 +198,12 @@
"dom": '<"top pager"f>rt<"clear">',
"paginate": false,
}));
$("#overduerulesf").on("submit", function(e){
$(".overduerulest").DataTable().search('').draw();
return true;
});
});
</script>
[% END %]