From 05a5442ee251eb9cae9e74050582ff09d2d8c523 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 31 Jan 2019 18:44:44 +0100 Subject: [PATCH] Implicitly submit the selected label if its the only form element --- wcfsetup/install/files/js/WCF.Label.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Label.js b/wcfsetup/install/files/js/WCF.Label.js index d41a1ddb31..21ad0901bb 100644 --- a/wcfsetup/install/files/js/WCF.Label.js +++ b/wcfsetup/install/files/js/WCF.Label.js @@ -280,6 +280,16 @@ WCF.Label.Chooser = Class.extend({ // replace button label = label.find('span > span'); $group.find('.dropdownToggle > span').removeClass().addClass(label.attr('class')).text(label.text()); + + // Submit the form if the label chooser is the only form element. + if (!onInit && this._container[0] && this._container[0].nodeName === 'FORM') { + if (elBySel('input:not([type="hidden"]):not([type="submit"]):not([type="reset"]), select, textarea', this._container[0]) === null) { + setTimeout((function () { + this._container.trigger('submit'); + //this._container[0].submit(); + }).bind(this), 100); + } + } }, /** -- 2.20.1