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
This commit is contained in:
Hadi Nategh 2015-09-01 13:38:22 +00:00
parent a9f7fbc31d
commit 187406187b

View File

@ -598,7 +598,11 @@ etemplate2.prototype.autocomplete_fixer = function ()
var form = self.DOMContainer; var form = self.DOMContainer;
if (form) 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 // 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 // we work around that by giving existing etemplate/empty.html url
// Safari shows same warning, thought Chrome userAgent also includes Safari // 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'}); 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');
} }
}; };