-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
When using an inputSpecification using required=true we could use a notEmpty validator in the chain to set our custom error message when the input was not set:
return [
'name' => $this->getName(),
'required' => true,
'filters' => [
['name' => 'Zend\Filter\StringTrim'],
],
'validators' => [
[
'name' => 'Zend\Validator\NotEmpty',
'break_chain_on_failure' => true,
'options' => [
'messages' => [
\Zend\Validator\NotEmpty::IS_EMPTY => 'custom message',
],
],
],
// further validators
],
];
InputFilter would then use this validator to get the error message. But now Zend\InputFilter\Input uses prepareRequiredValidationFailureMessage() the default NotEmpty::IS_EMPTY message without any option to customize this.
There is a pull request open to fix this zendframework/zend-inputfilter#73 but it is not merged yet while other solutions are discussed...
Metadata
Metadata
Assignees
Labels
No labels