Change error messages for UserFormsNumericField

This commit is contained in:
Julian Bennecker 2019-07-15 11:42:03 +02:00
parent f213eecaf9
commit 7bf85efba9

View File

@ -55,16 +55,10 @@ class UserFormsNumericField extends NumericField
}
if ((!empty($this->min) && $this->value < $this->min) || (!empty($this->max) && $this->value > $this->max)) {
$validator->validationError(
$this->name,
_t(
'UserFormsNumericField.ErrorMsg',
"This must be between {min} and {max}",
['min' => $this->min, 'max' => $this->max]
),
"validation",
false
);
$msg = (!empty($this->min) && $this->value < $this->min) ?
_t(self::class . 'RANGE_ERROR_MIN', 'Please enter a value that is no less than {min}.', $this->min) :
_t(self::class . 'RANGE_ERROR_MAX', 'Please enter a value that is no more than {max}.', $this->max);
$validator->validationError($this->name, $msg, "validation", false);
return false;
}