From 7bf85efba95ffe96d6c2ab078dbdf3ee886b0276 Mon Sep 17 00:00:00 2001 From: Julian Bennecker Date: Mon, 15 Jul 2019 11:42:03 +0200 Subject: [PATCH] Change error messages for UserFormsNumericField --- code/formfields/UserFormsNumericField.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/code/formfields/UserFormsNumericField.php b/code/formfields/UserFormsNumericField.php index a074f4b..984d785 100644 --- a/code/formfields/UserFormsNumericField.php +++ b/code/formfields/UserFormsNumericField.php @@ -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; }