Fix broken set_value() to properly accept strings as value, fix broken adding of free entries

This commit is contained in:
Nathan Gray 2013-10-07 10:10:54 +00:00
parent 57c412bd47
commit 764bde5bff

View File

@ -279,9 +279,9 @@ var et2_taglist = et2_selectbox.extend(
*/ */
set_value: function(value) set_value: function(value)
{ {
var values = jQuery.isArray(value) ? value : [value];
if (value && this.options.allowFreeEntries) if (value && this.options.allowFreeEntries)
{ {
var values = jQuery.isArray(value) ? value : [value];
var need_setdata = false; var need_setdata = false;
for(var i=0; i < values.length; ++i) for(var i=0; i < values.length; ++i)
{ {
@ -292,11 +292,11 @@ var et2_taglist = et2_selectbox.extend(
need_setdata = true; need_setdata = true;
} }
} }
if (this.taglist && need_setdata) this.taglist.setData(this._options2data(this.select_options)); if (this.taglist && need_setdata) this.taglist.setData(this._options2data(this.options.select_options));
} }
if(this.taglist == null) return; if(this.taglist == null) return;
this.taglist.clear(true); this.taglist.clear(true);
this.taglist.setValue(value); this.taglist.setValue(values);
}, },
getValue: function() getValue: function()