diff --git a/library/Icinga/Web/Form/Element/Number.php b/library/Icinga/Web/Form/Element/Number.php index 836142514..02f0aaad3 100644 --- a/library/Icinga/Web/Form/Element/Number.php +++ b/library/Icinga/Web/Form/Element/Number.php @@ -47,7 +47,6 @@ class Number extends FormElement */ public function init() { - $this->addValidator('Float', true); // true for breaking the validator chain on failure if ($this->min !== null) { $this->addValidator('GreaterThan', true, array('min' => $this->min)); } @@ -127,4 +126,19 @@ class Number extends FormElement { return $this->step; } + + /** + * (non-PHPDoc) + * @see \Zend_Form_Element::isValid() For the method documentation. + */ + public function isValid($value, $context = null) + { + $this->setValue($value); + $value = $this->getValue(); + if (! is_numeric($value)) { + $this->addError(sprintf($this->translate('\'%s\' is not a valid number'), $value)); + return false; + } + return parent::isValid($value, $context); + } }