From 2fe3c6e5cf8c5b35f913bd140c56c4db0e3f336d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 20 Aug 2015 14:36:55 +0200 Subject: [PATCH] events.js: Properly handle the default for param `autosubmit' refs #8369 --- public/js/icinga/events.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 71408d712..109eea255 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -246,6 +246,10 @@ encoding = 'application/x-www-form-urlencoded'; } + if (typeof autosubmit === 'undefined') { + autosubmit = false; + } + if ($button.length === 0) { $button = $('input[type=submit]', $form).add('button[type=submit]', $form).first(); } @@ -271,7 +275,7 @@ if (method === 'GET') { var dataObj = $form.serializeObject(); - if (typeof autosubmit === 'undefined' || ! autosubmit) { + if (! autosubmit) { if ($button.length && $button.attr('name') !== 'undefined') { dataObj[$button.attr('name')] = $button.attr('value'); } @@ -289,7 +293,7 @@ $form.find(':input:not(:disabled)').prop('disabled', true); }, 0); - if (! typeof autosubmit === 'undefined' && autosubmit) { + if (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.. @@ -310,7 +314,7 @@ data = $form.serializeArray(); } - if (typeof autosubmit === 'undefined' || ! autosubmit) { + if (! autosubmit) { if ($button.length && $button.attr('name') !== 'undefined') { if (encoding === 'multipart/form-data') { data.append($button.attr('name'), $button.attr('value'));