Browse Source

luci-base: form.js: fix AbstractValue.textvalue() for uci list options

Serialize the uci list value into a space separated string before passing
it to String.format() for HTML escaping. Without that change, empty strings
were returned whenever the underlying uci get operation yieled an array.

Fixes: #4993
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich 3 years ago
parent
commit
5c792aefc7
1 changed files with 3 additions and 0 deletions
  1. 3 0
      modules/luci-base/htdocs/luci-static/resources/form.js

+ 3 - 0
modules/luci-base/htdocs/luci-static/resources/form.js

@@ -1862,6 +1862,9 @@ var CBIAbstractValue = CBIAbstractElement.extend(/** @lends LuCI.form.AbstractVa
 		if (cval == null)
 			cval = this.default;
 
+		if (Array.isArray(cval))
+			cval = cval.join(' ');
+
 		return (cval != null) ? '%h'.format(cval) : null;
 	},