diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-10-23 01:01:50 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-10-23 01:13:04 +0200 |
commit | af48efd4f86e09210ea38356facd8c114feab7b9 (patch) | |
tree | 73c092205e751578c8232e424e2f9e135de6aabe /modules/luci-base/htdocs | |
parent | 1f32729428b4a859399c03efd255d7ae61a7b2b8 (diff) |
luci-base: add 'create' boolean to MultiValue form widget
Enables creation of custom choices.
example usage:
o = s.taboption('thistab', form.MultiValue, 'myoption');
o.create = true;
Form element now presents additional ' -- custom -- ' entry.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 624bc2c2f8..a228d3bf42 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -4116,6 +4116,14 @@ var CBIMultiValue = CBIDynamicList.extend(/** @lends LuCI.form.MultiValue.protot }, /** + * Allows custom value entry in addition to those already specified. + * + * @name LuCI.form.MultiValue.prototype#create + * @type boolean + * @default null + */ + + /** * Allows to specify the [display_items]{@link LuCI.ui.Dropdown.InitOptions} * property of the underlying dropdown widget. If omitted, the value of * the `size` property is used or `3` when `size` is unspecified as well. @@ -4146,6 +4154,7 @@ var CBIMultiValue = CBIDynamicList.extend(/** @lends LuCI.form.MultiValue.protot multiple: true, optional: this.optional || this.rmempty, select_placeholder: this.placeholder, + create: this.create, display_items: this.display_size || this.size || 3, dropdown_items: this.dropdown_size || this.size || -1, validate: L.bind(this.validate, this, section_id), |