[icinga-checkins] icinga.org: icingaweb2/bugfix/dashboard-rework-7751: JS/submitForm: Choosing the right submit button in FF

git at icinga.org git at icinga.org
Thu Nov 20 11:08:07 CET 2014


Module: icingaweb2
Branch: bugfix/dashboard-rework-7751
Commit: b0382da5fe4aea6ce19fab4e4d0eb28a658ac174
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=b0382da5fe4aea6ce19fab4e4d0eb28a658ac174

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Nov 20 11:07:10 2014 +0100

JS/submitForm: Choosing the right submit button in FF

refs #7751

---

 public/js/icinga/events.js |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js
index 4e4e41b..e7ac3e3 100644
--- a/public/js/icinga/events.js
+++ b/public/js/icinga/events.js
@@ -186,6 +186,7 @@
          *
          */
         submitForm: function (event, autosubmit) {
+            //return false;
             var self   = event.data.self;
             var icinga = self.icinga;
             // .closest is not required unless subelements to trigger this
@@ -198,9 +199,23 @@
             var data;
 
             if ($button.length === 0) {
-                var $el = $(event.currentTarget);
-                if ($el.is('input[type=submit]') || $el.is('button[type=submit]')) {
+                var $el;
+
+                if (typeof event.originalEvent !== 'undefined'
+                    && typeof event.originalEvent.explicitOriginalTarget === 'object') { // Firefox
+                    $el = $(event.originalEvent.explicitOriginalTarget);
+                    icinga.logger.info('events/submitForm: Button is event.originalEvent.explicitOriginalTarget');
+                } else {
+                    $el = $(event.currentTarget);
+                    icinga.logger.info('events/submitForm: Button is event.currentTarget');
+                }
+
+                if ($el && ($el.is('input[type=submit]') || $el.is('button[type=submit]'))) {
                     $button = $el;
+                } else {
+                    icinga.logger.error(
+                        'events/submitForm: Can not determine submit button, using the first one in form'
+                    );
                 }
             }
 



More information about the icinga-checkins mailing list