diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php index fe962fb64a..f09cbcea2e 100644 --- a/api/src/Etemplate/Widget/Select.php +++ b/api/src/Etemplate/Widget/Select.php @@ -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); }