From: Alexander Ebert Date: Thu, 31 Jan 2019 17:44:44 +0000 (+0100) Subject: Implicitly submit the selected label if its the only form element X-Git-Tag: 5.2.0_Alpha_1~325 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05a5442ee251eb9cae9e74050582ff09d2d8c523;p=GitHub%2FWoltLab%2FWCF.git Implicitly submit the selected label if its the only form element --- 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); + } + } }, /**