Bug 11127: OPAC suggestions form - complain when trying to 'delete selected' without having selected any

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 <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b02f40d6e1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2013-10-24 11:41:11 +02:00 committed by Fridolin Somers
parent f4a717106d
commit 72e0a79fab
1 changed files with 9 additions and 1 deletions

View File

@ -280,11 +280,19 @@
enableCheckboxActions();
});
$("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
.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 %]
});