diff --git a/library/Icinga/Web/Form/Element/Number.php b/library/Icinga/Web/Form/Element/Number.php index 8a1217363..31bec6433 100644 --- a/library/Icinga/Web/Form/Element/Number.php +++ b/library/Icinga/Web/Form/Element/Number.php @@ -134,8 +134,8 @@ class Number extends FormElement { $this->setValue($value); $value = $this->getValue(); - if (! is_numeric($value)) { - $this->addError(sprintf($this->translate('\'%s\' is not a valid number'), $value)); + if ($this->isRequired() && ! is_numeric($value)) { + $this->addError(sprintf(t('\'%s\' is not a valid number'), $value)); return false; } return parent::isValid($value, $context);