From 570dada0d802e339875c402c0fc677a7db697f71 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 21 Jul 2015 14:15:12 +0200 Subject: [PATCH] js: Manually submit the form if it's being automatically submitted... ...in case we're submitting a multipart/form-data form using the iframe fallback. The form wouldn't be submitted otherwise. refs #8758 --- public/js/icinga/events.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index a1048095b..000ecf103 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -192,7 +192,6 @@ * */ submitForm: function (event, autosubmit) { - //return false; var self = event.data.self; var icinga = self.icinga; // .closest is not required unless subelements to trigger this @@ -277,7 +276,21 @@ setTimeout(function () { $form.find(':input:not(:disabled)').prop('disabled', true); }, 0); - return true; + + if (! typeof autosubmit === 'undefined' && autosubmit) { + if ($button.length) { + // We're autosubmitting the form so the button has not been clicked, however, + // to be really safe, we're disabling the button explicitly, just in case.. + $button.prop('disabled', true); + } + + $form[0].submit(); // This should actually not trigger the onSubmit event, let's hope that this is true for all browsers.. + event.stopPropagation(); + event.preventDefault(); + return false; + } else { + return true; + } } data = new window.FormData($form[0]);