Avoid some missing attribute warnings by not trying to set needed on readonlys, which don't support it.

This commit is contained in:
Nathan Gray 2014-01-11 16:40:45 +00:00
parent f49cdf4d85
commit a458019490
2 changed files with 9 additions and 2 deletions

View File

@ -202,6 +202,9 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
'readonly': this.options.readonly, 'readonly': this.options.readonly,
'value': this.options.value[this.prefix+field_name] 'value': this.options.value[this.prefix+field_name]
}; };
// Can't have a required readonly, it will warn & be removed later, so avoid the warning
if(attrs.readonly === true) delete attrs.needed;
if(this[setup_function]) { if(this[setup_function]) {
var no_skip = this[setup_function].call(this, field_name, field, attrs); var no_skip = this[setup_function].call(this, field_name, field, attrs);
if(!no_skip) continue; if(!no_skip) continue;

View File

@ -308,9 +308,13 @@ var et2_radioGroup = et2_valueWidget.extend([et2_IDetachedDOM],
label: _options[key], label: _options[key],
ro_true: this.options.ro_true, ro_true: this.options.ro_true,
ro_false: this.options.ro_false, ro_false: this.options.ro_false,
readonly: this.options.readonly, readonly: this.options.readonly
needed: this.options.needed
}; };
// Can't have a required readonly, it will warn & be removed later, so avoid the warning
if(attrs.readonly === false)
{
attrs.needed = this.options.needed;
}
var radio = et2_createWidget("radio", attrs, this); var radio = et2_createWidget("radio", attrs, this);
} }
this.set_value(this.value); this.set_value(this.value);