diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-07-28 17:24:12 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-08-01 16:45:54 +0200 |
commit | 360e9769d612d4aab388cae2ddb74794eb08240f (patch) | |
tree | b3efb5a577641fc6c9d5a794aee2ef5a1ee38df7 /modules/luci-base/htdocs | |
parent | b20f000c85e7e10ffa4538a3240a9975d2b0d904 (diff) |
luci-base: ui.js: mark widget optional if empty choice is present
Fixes: #2943
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index f6a964fb10..fd413042f9 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -223,6 +223,9 @@ var UISelect = UIElement.extend({ widget: 'select', orientation: 'horizontal' }, options); + + if (this.choices.hasOwnProperty('')) + this.options.optional = true; }, render: function() { @@ -243,7 +246,7 @@ var UISelect = UIElement.extend({ 'multiple': this.options.multiple ? '' : null })); - if (this.options.optional || this.choices.hasOwnProperty('')) + if (this.options.optional) frameEl.lastChild.appendChild(E('option', { 'value': '', 'selected': (this.values.length == 0 || this.values[0] == '') ? '' : null |