Bug 17057: (follow-up) Replace onsubmit attributes

This patch removes the "onsubmit" attribute from the place hold form.

To test, apply the patch and test placing a hold:

Begin the process of placing a hold on a single title. On the
place hold screen, uncheck the "Hold next available item" checkbox and
click the "Place hold" button.

You should be get an alert saying "Please select an item to place a
hold." Select an item and click the "Place hold" button again. The hold
should be placed.

This patch affects the form validation for placing multiple holds, but I
don't think the JavaScript ever has a chance to run: The template blocks
the user from placing multiple holds if one of the titles has no items.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2019-08-13 15:54:30 +00:00 committed by Martin Renvoize
parent 54d7fe5250
commit 388f5fa0ff
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -167,11 +167,7 @@
<fieldset class="rows left">
<legend>Hold details</legend>
[% UNLESS ( multi_hold ) %]
<form action="placerequest.pl" method="post" onsubmit="return check();" name="form" id="hold-request-form">
[% ELSE %]
<form action="placerequest.pl" method="post" onsubmit="return checkMultiHold();" name="form">
[% END %]
<form action="placerequest.pl" method="post" name="form" id="hold-request-form">
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="type" value="str8" />
@ -747,6 +743,16 @@
"margin-right":"0em"
});
[% UNLESS ( multi_hold ) %]
$("#hold-request-form").on("submit", function(){
return check();
});
[% ELSE %]
$("#hold-request-form").on("submit", function(){
return checkMultiHold();
});
[% END %]
});
function check() {