Skip to content
Snippets Groups Projects
Commit a22b9a22 authored by Ere Maijala's avatar Ere Maijala Committed by André Lahmann
Browse files

Store clicked button in a private variable in lightbox.

parent 58e9e2c1
No related merge requests found
...@@ -5,7 +5,7 @@ VuFind.lightbox = (function() { ...@@ -5,7 +5,7 @@ VuFind.lightbox = (function() {
var _currentUrl = false; var _currentUrl = false;
var refreshOnClose = false; var refreshOnClose = false;
// Elements // Elements
var _modal, _modalBody; var _modal, _modalBody, _clickedButton = null;
// Utilities // Utilities
var _html = function(html) { var _html = function(html) {
_modalBody.html(html); _modalBody.html(html);
...@@ -70,9 +70,7 @@ VuFind.lightbox = (function() { ...@@ -70,9 +70,7 @@ VuFind.lightbox = (function() {
}; };
var _storeClickedStatus = function() { var _storeClickedStatus = function() {
var form = $(this).prop('form') || $(this).closest('form')[0]; _clickedButton = this;
$(form.elements).filter('[type=submit]').removeAttr('clicked');
$(this).attr('clicked', true);
}; };
var _xhr = false; var _xhr = false;
...@@ -176,7 +174,8 @@ VuFind.lightbox = (function() { ...@@ -176,7 +174,8 @@ VuFind.lightbox = (function() {
var data = $(form).serializeArray(); var data = $(form).serializeArray();
data.push({'name':'layout', 'value':'lightbox'}); // Return in lightbox, please data.push({'name':'layout', 'value':'lightbox'}); // Return in lightbox, please
// Add submit button information // Add submit button information
var submit = $(form).find('[type=submit][clicked]'); var submit = $(_clickedButton);
_clickedButton = null;
if (submit.length > 0) { if (submit.length > 0) {
if (typeof submit.data('lightbox-ignore') !== 'undefined') { if (typeof submit.data('lightbox-ignore') !== 'undefined') {
return true; return true;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment