use csv_split on options of text field, to allow to enclose preg in quote to allow comma in it

This commit is contained in:
Ralf Becker 2012-03-17 13:42:01 +00:00
parent ff4152dd42
commit 03c21735e6

View File

@ -1267,12 +1267,12 @@ class etemplate extends boetemplate
{ {
$value = is_numeric($pre) ? self::number_format($value,$pre,$readonly) : sprintf($pre,$value); $value = is_numeric($pre) ? self::number_format($value,$pre,$readonly) : sprintf($pre,$value);
} }
$cell_options .= ',,'.($cell['type'] == 'int' ? '/^-?[0-9]*$/' : '/^-?[0-9]*[,.]?[0-9]*$/').',number'; $cell_options .= ',,'.($cell['type'] == 'int' ? '/^-?[0-9]*$/' : '"/^-?[0-9]*[,.]?[0-9]*$/"').',number';
// fall-through // fall-through
case 'hidden': case 'hidden':
case 'passwd': case 'passwd':
case 'text': // size: [length][,maxLength[,preg[,html5type]]] case 'text': // size: [length][,maxLength[,preg[,html5type]]]
$cell_opts = $c = explode(',',$cell_options); $cell_opts = $c = self::csv_split($cell_options); // allows to enclose preg in quote to allow comma
// fix preg, in case it contains a comma (html5type is only letters and always last option!) // fix preg, in case it contains a comma (html5type is only letters and always last option!)
if (count($cell_opts) > 3) if (count($cell_opts) > 3)
{ {