From 187406187bd55240352f4310471af2c16e37bcf7 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 1 Sep 2015 13:38:22 +0000 Subject: [PATCH] Fix mail's send button does not work in some occasions: - CKEditor has its own submit handler which was making conflict with our autocomplete submit --- etemplate/js/etemplate2.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 1f6feb5969..d9f0b423d7 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -598,7 +598,11 @@ etemplate2.prototype.autocomplete_fixer = function () var form = self.DOMContainer; if (form) { - form.onsubmit = function(){return false;}; + // Stop submit propagation in order to not fire other possible submit events + // for instance, CKEditor has its own submit event handler which we do not want to + // fire that on submit + form.onsubmit = function(e){e.stopPropagation();}; + // Firefox give a security warning when transmitting to "about:blank" from a https site // we work around that by giving existing etemplate/empty.html url // Safari shows same warning, thought Chrome userAgent also includes Safari @@ -606,7 +610,9 @@ etemplate2.prototype.autocomplete_fixer = function () { jQuery(form).attr({action: egw.webserverUrl+'/etemplate/empty.html',method:'post'}); } - form.submit(); + // need to trigger submit because submit() would not trigger onsubmit event + // since the submit does not get fired directly via user interaction. + jQuery(form).trigger('submit'); } };