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() {
var _currentUrl = false;
var refreshOnClose = false;
// Elements
var _modal, _modalBody;
var _modal, _modalBody, _clickedButton = null;
// Utilities
var _html = function(html) {
_modalBody.html(html);
......@@ -70,9 +70,7 @@ VuFind.lightbox = (function() {
};
var _storeClickedStatus = function() {
var form = $(this).prop('form') || $(this).closest('form')[0];
$(form.elements).filter('[type=submit]').removeAttr('clicked');
$(this).attr('clicked', true);
_clickedButton = this;
};
var _xhr = false;
......@@ -176,7 +174,8 @@ VuFind.lightbox = (function() {
var data = $(form).serializeArray();
data.push({'name':'layout', 'value':'lightbox'}); // Return in lightbox, please
// Add submit button information
var submit = $(form).find('[type=submit][clicked]');
var submit = $(_clickedButton);
_clickedButton = null;
if (submit.length > 0) {
if (typeof submit.data('lightbox-ignore') !== 'undefined') {
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