diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-12-16 17:44:27 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-12-16 17:46:01 +0100 |
commit | 90a161018c9c7650a27a66f8e0a4f060d1ccebd6 (patch) | |
tree | 42cc9664914d08ace104b6b74647e5282755c5ef /modules/luci-base/htdocs | |
parent | f6410361c8fa84d258c505bba5b6ad157d6a30ee (diff) |
luci-base: ui.js: allow custom validation in Dropdown and DynamicList
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 31f89339c..a60aea911 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -457,9 +457,9 @@ var UIDropdown = UIElement.extend({ 'placeholder': this.options.custom_placeholder || this.options.placeholder }); - if (this.options.datatype) - L.ui.addValidator(createEl, this.options.datatype, - true, null, 'blur', 'keyup'); + if (this.options.datatype || this.options.validate) + L.ui.addValidator(createEl, this.options.datatype || 'string', + true, this.options.validate, 'blur', 'keyup'); sb.lastElementChild.appendChild(E('li', { 'data-value': '-' }, createEl)); } @@ -1270,9 +1270,9 @@ var UIDynamicList = UIElement.extend({ dl.lastElementChild.appendChild(inputEl); dl.lastElementChild.appendChild(E('div', { 'class': 'cbi-button cbi-button-add' }, '+')); - if (this.options.datatype) - L.ui.addValidator(inputEl, this.options.datatype, - true, null, 'blur', 'keyup'); + if (this.options.datatype || this.options.validate) + L.ui.addValidator(inputEl, this.options.datatype || 'string', + true, this.options.validate, 'blur', 'keyup'); } for (var i = 0; i < this.values.length; i++) |