From 72e0a79fab2ca9bbc7edd436e813448d0a29da72 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Oct 2013 11:41:11 +0200 Subject: [PATCH] Bug 11127: OPAC suggestions form - complain when trying to 'delete selected' without having selected any MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit To reproduce: 1/ go on opac-suggestions.pl 2/ create a suggestion 3/ click on the delete link without checking any checkbox The form is submitted with a message "The selected suggestions have been deleted.". Test plan: 0/ enable the bootstrap theme 1/ after applying the patch, click on delete without any checkbox checked, a js alert should occur. 2/ check at least a cb and click on the delete link. The deletion should work. Followed test plan. Patch behaves as expected. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Passes all tests and QA script, works as described. Signed-off-by: Galen Charlton (cherry picked from commit b02f40d6e1febc0802b82660c56f1745ea664fd5) Signed-off-by: Fridolin Somers --- .../opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt index 0ba041213e..6479975ae3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -280,11 +280,19 @@ enableCheckboxActions(); }); $("#removeitems").html(""+_("Delete")+"") - .click(function(){ + .click(function(e){ + e.preventDefault(); $("#myform").submit(); return false; }); enableCheckboxActions(); + $("#myform").on('submit', function() { + if ( $("input:checked").size() < 1 ) { + alert(MSG_NO_RECORD_SELECTED); + return false; + } + return true; + }); [% END %] }); -- 2.39.5