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;