From e56a46634f7de1852f0860065882d3b5b722e7d1 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Wed, 12 Nov 2014 14:31:22 -0500 Subject: [PATCH] Make sure validator is called first, not removed, and that prevented events don't go through on the Lightbox. --- themes/bootstrap3/js/lightbox.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index 7ff98a3e9ca..c921b2e5aa5 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -329,21 +329,23 @@ var Lightbox = { * is called and the 'shown' lightbox event is triggered */ registerForms: function() { - var form = $("#modal").find('form'); - form.validator(); - var name = $(form).attr('name'); + var $form = $("#modal").find('form'); + $form.validator(); + var name = $form.attr('name'); // Assign form handler based on name if(typeof name !== "undefined" && typeof Lightbox.formHandlers[name] !== "undefined") { - $(form).unbind('submit').submit(Lightbox.formHandlers[name]); + $form.submit(Lightbox.formHandlers[name]); // Default action, with custom callback } else if(typeof Lightbox.formCallbacks[name] !== "undefined") { - $(form).unbind('submit').submit(function(evt){ + $form.submit(function(evt){ + if(evt.isDefaultPrevented()) return false; Lightbox.submit($(evt.target), Lightbox.formCallbacks[name]); return false; }); // Default } else { - $(form).unbind('submit').submit(function(evt){ + $form.unbind('submit').submit(function(evt){ + if(evt.isDefaultPrevented()) return false; Lightbox.submit($(evt.target), function(html){ Lightbox.checkForError(html, Lightbox.close); }); -- GitLab