mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
fixed broken regular expression for multiple comma-separated values (dash in character class has to be last character!)
This commit is contained in:
parent
8c6ac14093
commit
f011a6c3d1
@ -291,7 +291,7 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
*/
|
||||
set_value: function(_value)
|
||||
{
|
||||
if(typeof _value == "string" && this.options.multiple && _value.match(/^[,0-9A-Za-z/-_]+$/) !== null)
|
||||
if(typeof _value == "string" && this.options.multiple && _value.match(this._is_multiple_regexp) !== null)
|
||||
{
|
||||
_value = _value.split(',');
|
||||
}
|
||||
@ -312,7 +312,7 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
|
||||
// Not having a value to look up causes an infinite loop
|
||||
if(!search[j]) continue;
|
||||
|
||||
|
||||
// Options are not indexed, so we must look
|
||||
for(var i = 0; !found && i < this.options.select_options.length; i++)
|
||||
{
|
||||
@ -748,7 +748,7 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
.appendTo(option);
|
||||
this.egw().link_title('home-accounts', value, function(name) {this.text(name).removeClass("loading");}, label);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Overwritten attachToDOM metod to modify attachToDOM
|
||||
*/
|
||||
|
@ -423,10 +423,20 @@ var et2_selectbox = et2_inputWidget.extend(
|
||||
this.set_select_options(this.options.select_options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Regular expression, to check string-value contains multiple comma-separated values
|
||||
*/
|
||||
_is_multiple_regexp: /^[,0-9A-Za-z/_-]+$/,
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param _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(this._is_multiple_regexp) !== null)
|
||||
{
|
||||
_value = _value.split(',');
|
||||
}
|
||||
@ -915,7 +925,7 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM],
|
||||
|
||||
if(typeof _value == "string")
|
||||
{
|
||||
_value = _value.match(/^[,0-9A-Za-z]+$/) !== null ? _value.split(',') : [_value];
|
||||
_value = _value.match(this._is_multiple_regexp) !== null ? _value.split(',') : [_value];
|
||||
}
|
||||
this.span.empty();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user