luci-base: ui.js: allow custom validation in Dropdown and DynamicList
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90a161018c
)
This commit is contained in:
parent
f68a32d294
commit
ce4d8c5a9a
1 changed files with 6 additions and 6 deletions
|
@ -990,9 +990,9 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
|
|||
'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));
|
||||
}
|
||||
|
@ -2105,9 +2105,9 @@ var UIDynamicList = UIElement.extend(/** @lends LuCI.ui.DynamicList.prototype */
|
|||
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++) {
|
||||
|
|
Loading…
Reference in a new issue