From 2d3470b700237f1c71138c085a4f73c7a809d1a0 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 27 Jul 2019 22:17:33 +0200 Subject: luci-base: don't treat .rmempty flag as optional for ListValue widgets Restore the old CBI behaviour of not automatically rendering empty selection choices in ListValue select dropdowns when .rmempty is specified. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/form.js | 2 +- modules/luci-base/htdocs/luci-static/resources/ui.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/luci-base/htdocs') diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 58d8f7100c..ef2f18e35a 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1460,7 +1460,7 @@ var CBIListValue = CBIValue.extend({ id: this.cbid(section_id), size: this.size, sort: this.keylist, - optional: this.rmempty || this.optional, + optional: this.optional, placeholder: this.placeholder, validate: L.bind(this.validate, this, section_id) }); diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 43afc698f6..2ba0b0d1e8 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -243,7 +243,7 @@ var UISelect = UIElement.extend({ 'multiple': this.options.multiple ? '' : null })); - if (this.options.optional) + if (this.options.optional || this.choices.hasOwnProperty('')) frameEl.lastChild.appendChild(E('option', { 'value': '', 'selected': (this.values.length == 0 || this.values[0] == '') ? '' : null -- cgit v1.2.3