mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Etemplate - change select multiple validation to also consider rows > 1 to enable multiple
This commit is contained in:
parent
ef50e36b49
commit
5b4fd418bf
@ -129,6 +129,7 @@ class Select extends Etemplate\Widget
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
$widget_type = $this->attrs['type'] ? $this->attrs['type'] : $this->type;
|
||||
$multiple = $this->attrs['multiple'] || $this->getElementAttribute($form_name, 'rows') > 1;
|
||||
|
||||
$ok = true;
|
||||
if (!$this->is_readonly($cname, $form_name))
|
||||
@ -147,7 +148,7 @@ class Select extends Etemplate\Widget
|
||||
if ($child->type == 'option') $allowed[] = (string)$child->attrs['value'];
|
||||
}
|
||||
|
||||
if (!$this->attrs['multiple'] || !($this->attrs['options'] > 1)) $allowed[] = '';
|
||||
if (!$multiple ) $allowed[] = '';
|
||||
|
||||
foreach((array) $value as $val)
|
||||
{
|
||||
@ -198,7 +199,7 @@ class Select extends Etemplate\Widget
|
||||
{
|
||||
self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),'');
|
||||
}
|
||||
if (!$this->attrs['multiple'] && is_array($value) && count($value) > 1)
|
||||
if (!$multiple && is_array($value) && count($value) > 1)
|
||||
{
|
||||
$value = array_shift($value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user