diff --git a/src/Input.php b/src/Input.php index 6342040b..9d316c0b 100644 --- a/src/Input.php +++ b/src/Input.php @@ -491,7 +491,20 @@ protected function injectNotEmptyValidator() */ protected function prepareRequiredValidationFailureMessage() { - $notEmpty = new NotEmpty(); + $chain = $this->getValidatorChain(); + $validators = $chain->getValidators(); + + foreach ($validators as $validator) { + if ($validator['instance'] instanceof NotEmpty) { + $notEmpty = $validator['instance']; + break; + } + } + + if (!isset($notEmpty)) { + $notEmpty = new NotEmpty(); + } + $templates = $notEmpty->getOption('messageTemplates'); return [ NotEmpty::IS_EMPTY => $templates[NotEmpty::IS_EMPTY],