convert numbers to string for consistent matching, 0 was never set, because it was treated as already set, which gives wrong result if it is not first option

This commit is contained in:
Ralf Becker
2014-06-04 09:52:02 +00:00
parent 07cd6838f5
commit 2c5ba307b5

View File

@ -423,7 +423,9 @@ var et2_selectbox = et2_inputWidget.extend(
this.set_select_options(this.options.select_options); this.set_select_options(this.options.select_options);
}, },
set_value: function(_value) { set_value: function(_value)
{
if (typeof _value == "number") _value = ""+_value; // convert to string for consitent matching
if(typeof _value == "string" && this.options.multiple && _value.match(/^[,0-9A-Za-z/-_]+$/) !== null) if(typeof _value == "string" && this.options.multiple && _value.match(/^[,0-9A-Za-z/-_]+$/) !== null)
{ {
_value = _value.split(','); _value = _value.split(',');
@ -738,8 +740,8 @@ jQuery.extend(et2_selectbox,
{ {
/** /**
* Find the select options for a widget, out of the many places they could be. * Find the select options for a widget, out of the many places they could be.
* @param {et2_widget} Widget to check for. Should be some sort of select widget. * @param {et2_widget} widget to check for. Should be some sort of select widget.
* @param {object} Select options in attributes array * @param {object} attr_options Select options in attributes array
* @return {object} Select options, or empty object * @return {object} Select options, or empty object
*/ */
find_select_options: function(widget, attr_options) find_select_options: function(widget, attr_options)