From 243c6c525dca3496fafb6e97bd1d1f46951b553d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 2 May 2020 23:51:22 +0200 Subject: [PATCH] luci-base: ui.js: fix input value reading for select widgets Fixes: #3989 Fixes: 81effc111 ("luci-base: ui.js: assume select widget by default for ListValue widget") Signed-off-by: Jo-Philipp Wich (cherry picked from commit e3ef463ccdd7d32eef1717203bd872272c57793d) --- modules/luci-base/htdocs/luci-static/resources/ui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index bcdfd7982..3638e3e1a 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -773,7 +773,7 @@ var UISelect = UIElement.extend(/** @lends LuCI.ui.Select.prototype */ { bind: function(frameEl) { this.node = frameEl; - if (this.options.widget == 'select') { + if (this.options.widget != 'radio' && this.options.widget != 'checkbox') { this.setUpdateEvents(frameEl.firstChild, 'change', 'click', 'blur'); this.setChangeEvents(frameEl.firstChild, 'change'); } @@ -792,7 +792,7 @@ var UISelect = UIElement.extend(/** @lends LuCI.ui.Select.prototype */ { /** @override */ getValue: function() { - if (this.options.widget == 'select') + if (this.options.widget != 'radio' && this.options.widget != 'checkbox') return this.node.firstChild.value; var radioEls = this.node.querySelectorAll('input[type="radio"]'); @@ -805,7 +805,7 @@ var UISelect = UIElement.extend(/** @lends LuCI.ui.Select.prototype */ { /** @override */ setValue: function(value) { - if (this.options.widget == 'select') { + if (this.options.widget != 'radio' && this.options.widget != 'checkbox') { if (value == null) value = ''; -- 2.25.1