From: Daniel Pearl Date: Wed, 12 Dec 2018 17:51:07 +0000 (-0500) Subject: LP#1029601: Prevent double-clicking when submitting hold requests. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fdpearl%2FLP1029601_double_click_submit;p=working%2FEvergreen.git LP#1029601: Prevent double-clicking when submitting hold requests. Double clicking on hold submit buttons causes multiple holds to be generated. This adds some code to disable the Submit button(s) after the first click, so subsequent clicks don't "work" in unintended ways. Signed-off-by: Dan Pearl --- diff --git a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 index b2513a6a47..009145aeb2 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 @@ -6,10 +6,18 @@ + +

[% l('Place Hold') %]

-
+ [% FOR k IN ctx.orig_params.keys %] @@ -85,7 +93,7 @@ ); [% END %] - + [% ELSIF hdata.hold_failed; any_failures = 1 %]
[% l("Hold was not successfully placed"); %]
@@ -133,7 +141,7 @@ [% |l %]You have permission to override some of the failed holds. Click Submit to override and place your hold on the selected items.[% END %]
- diff --git a/Open-ILS/web/js/ui/default/opac/holds-validation.js b/Open-ILS/web/js/ui/default/opac/holds-validation.js index 7345e3fca9..688d5dad93 100644 --- a/Open-ILS/web/js/ui/default/opac/holds-validation.js +++ b/Open-ILS/web/js/ui/default/opac/holds-validation.js @@ -75,7 +75,12 @@ function confirmMultipleHolds() { function validateHoldForm() { var res = validateMethodSelections(document.getElementsByClassName("hold-alert-method")); if (res.isValid) { - return confirmMultipleHolds(); + var result = confirmMultipleHolds(); + if (result) { + var submit_element = document.getElementById("place_hold_submit"); + submit_element.disabled = true; + } + return result; } else { alert(eg_opac_i18n.EG_MISSING_REQUIRED_INPUT); res.culpritNames.forEach(function(n){