luci-base: do not add validation for named section if readonly is set
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
3358516e1f
commit
1a2b7fef6c
1 changed files with 14 additions and 12 deletions
|
@ -2212,21 +2212,23 @@ var CBITypedSection = CBIAbstractSection.extend(/** @lends LuCI.form.TypedSectio
|
|||
|
||||
return this.handleAdd(ev, nameEl.value);
|
||||
}),
|
||||
'disabled': true
|
||||
'disabled': this.map.readonly || true
|
||||
}, [ btn_title || _('Add') ])
|
||||
]);
|
||||
|
||||
ui.addValidator(nameEl, 'uciname', true, function(v) {
|
||||
var button = document.querySelector('.cbi-section-create > .cbi-button-add');
|
||||
if (v !== '') {
|
||||
button.disabled = false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
button.disabled = true;
|
||||
return _('Expecting: %s').format(_('non-empty value'));
|
||||
}
|
||||
}, 'blur', 'keyup');
|
||||
if (this.map.readonly !== true) {
|
||||
ui.addValidator(nameEl, 'uciname', true, function(v) {
|
||||
var button = document.querySelector('.cbi-section-create > .cbi-button-add');
|
||||
if (v !== '') {
|
||||
button.disabled = null;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
button.disabled = true;
|
||||
return _('Expecting: %s').format(_('non-empty value'));
|
||||
}
|
||||
}, 'blur', 'keyup');
|
||||
}
|
||||
}
|
||||
|
||||
return createEl;
|
||||
|
|
Loading…
Reference in a new issue