Get custom selectbox options working

This commit is contained in:
Nathan Gray 2011-10-12 20:56:11 +00:00
parent 0700876775
commit cf75387f56
2 changed files with 11 additions and 5 deletions

View File

@ -111,7 +111,7 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
var attrs = {
'id': field_name,
'statustext': field.help,
'required': field.needed
'required': field.needed,
};
if(this[setup_function]) {
this[setup_function].call(this, field_name, field, attrs);
@ -129,6 +129,7 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
.appendTo(row);
this.rows[field_name] = cf[0];
}
// No label on the widget itself
delete(attrs.label);
@ -204,7 +205,7 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
attrs.size = field.len;
},
_setup_select: function(field_name, field, attrs) {
attrs.sel_options = field.values;
attrs.select_options = field.values;
},
/**
@ -228,7 +229,7 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], {
var value = _values["value"][this.prefix + field_name] ? _values["value"][this.prefix + field_name] : null;
if(this.widgets[field_name].implements( et2_IDetachedDOM))
{
widget_values = {"value": value};
var widget_values = {"value": value};
this.widgets[field_name].setDetachedAttributes(this.widgets[field_name].getDetachedNodes(), widget_values);
}
else

View File

@ -80,7 +80,12 @@ var et2_selectbox = et2_inputWidget.extend({
if(this.getArrayMgr("sel_options"))
{
var content_options = this.getArrayMgr("sel_options").getEntry(this.id);
if(content_options) _attrs["select_options"] = jQuery.merge(_attrs["select_options"],content_options);
if(_attrs["select_options"] && content_options)
{
_attrs["select_options"] = jQuery.merge(_attrs["select_options"],content_options);
} else if (content_options) {
_attrs["select_options"] = content_options;
}
}
// Check whether the options entry was found, if not read it from the
@ -105,7 +110,7 @@ var et2_selectbox = et2_inputWidget.extend({
var option = $j(document.createElement("option"))
.attr("value", _value)
.text(_label);
.text(_label+"");
if (typeof _title != "undefined" && _title)
{