From 07f4f3f69d2111cd3725c30c883cc4b92641293c Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Mon, 14 Mar 2016 13:10:31 -0400
Subject: [PATCH] Lightbox: Move button disabling to after handler checking.

---
 themes/bootstrap3/js/lightbox.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index 06b0a61d990..b8e6edae3fe 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -181,10 +181,6 @@ VuFind.lightbox = (function() {
       if (typeof submit.data('lightbox-ignore') !== 'undefined') {
         return true;
       }
-      // Prevent multiple submission of submit button in lightbox
-      if (submit.closest(_modal).length > 0) {
-        submit.attr('disabled', 'disabled');
-      }
       buttonData.name = submit.attr('name') || 'submit';
       buttonData.value = submit.attr('value') || 1;
     }
@@ -209,6 +205,10 @@ VuFind.lightbox = (function() {
     }
     // Loading
     _modalBody.prepend('<i class="fa fa-spinner fa-spin pull-right"></i>');
+    // Prevent multiple submission of submit button in lightbox
+    if (submit.closest(_modal).length > 0) {
+      submit.attr('disabled', 'disabled');
+    }
     // Get Lightbox content
     ajax({
       url: form.action || _currentUrl,
-- 
GitLab