forked from extern/egroupware
allow space in CF selectbox values and warn about other not supported values
This commit is contained in:
parent
979c96b854
commit
218af30b7c
@ -279,6 +279,13 @@ class admin_customfields
|
||||
$this->tmpl->exec($exec,$content,$sel_options,$readonlys,$preserve);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check selectbox values to match regular expression in et2_widget_selectbox.js: _is_multiple_regexp
|
||||
*
|
||||
* If values do not match, comma-separated values are not split by comma!
|
||||
*/
|
||||
const CHECK_MULTISELCT_VALUE = '/^[0-9A-Za-z\/_ -]+$/';
|
||||
|
||||
/**
|
||||
* Edit/Create Custom fields with type
|
||||
*
|
||||
@ -346,6 +353,14 @@ class admin_customfields
|
||||
{
|
||||
list($var_raw,$value) = explode('=',trim($line),2);
|
||||
$var = trim($var_raw);
|
||||
if (!preg_match(self::CHECK_MULTISELCT_VALUE, $var))
|
||||
{
|
||||
Api\Etemplate::set_validation_error('cf_values',
|
||||
lang('Invalide value "%1", use only:', $var)."\n".
|
||||
preg_replace('/^.*\[([^]]+)\].*$/', '$1', self::CHECK_MULTISELCT_VALUE));
|
||||
$action = 'apply'; // do not close the window to show validation error
|
||||
if (!$cf_id) break 2; // only stop storing of new CFs
|
||||
}
|
||||
$values[$var] = trim($value)==='' ? $var : $value;
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
/**
|
||||
* Regular expression, to check string-value contains multiple comma-separated values
|
||||
*/
|
||||
_is_multiple_regexp: /^[,0-9A-Za-z/_-]+$/,
|
||||
_is_multiple_regexp: /^[,0-9A-Za-z/_ -]+$/,
|
||||
|
||||
/**
|
||||
* Regular expression and replace value for escaping values in jQuery selectors used to find options
|
||||
|
Loading…
Reference in New Issue
Block a user