diff --git a/library/Icinga/Web/Form/Element/Number.php b/library/Icinga/Web/Form/Element/Number.php index 212c0ed1d..afbd07df6 100644 --- a/library/Icinga/Web/Form/Element/Number.php +++ b/library/Icinga/Web/Form/Element/Number.php @@ -46,11 +46,12 @@ class Number extends FormElement */ public function init() { - if ($this->min !== null) { - $this->addValidator('GreaterThan', true, array('min' => $this->min)); - } - if ($this->max !== null) { - $this->addValidator('LessThan', true, array('max' => $this->max)); + if ($this->min !== null || $this->max !== null) { + $this->addValidator('Between', true, array( + 'min' => $this->min === null ? -INF : $this->min, + 'max' => $this->max === null ? INF : $this->max, + 'inclusive' => true + )); } } @@ -86,7 +87,7 @@ class Number extends FormElement */ public function setMax($max) { - $this->max = (int) $max; + $this->max = (float) $max; return $this; }