summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-27 22:17:33 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-27 22:33:36 +0200
commit2d3470b700237f1c71138c085a4f73c7a809d1a0 (patch)
treea52331429a04a17ff7c36e159ebe3c4568e3ee66 /modules
parentb949c0262431c74b0a5f0c426d878207f1d2742a (diff)
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 <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js2
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js2
-rw-r--r--modules/luci-base/luasrc/view/cbi/lvalue.htm2
3 files changed, 3 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 58d8f7100..ef2f18e35 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 43afc698f..2ba0b0d1e 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
diff --git a/modules/luci-base/luasrc/view/cbi/lvalue.htm b/modules/luci-base/luasrc/view/cbi/lvalue.htm
index 920b5e9f9..28141472f 100644
--- a/modules/luci-base/luasrc/view/cbi/lvalue.htm
+++ b/modules/luci-base/luasrc/view/cbi/lvalue.htm
@@ -7,7 +7,7 @@
sort = self.keylist,
widget = self.widget,
datatype = self.datatype,
- optional = self.optional or self.rmempty,
+ optional = self.optional,
placeholder = self.placeholder
}
}))%>></div>