【发布时间】:2018-04-24 17:23:12
【问题描述】:
如果我没有在我的输入过滤器中指定验证器,我应该在 ZF3 中的哪里自定义表单验证消息?
如果我使用ZF3 documentation 中显示的代码,如下所示,如果输入为空,'required' => true, 参数将导致formElementErrors() 帮助器在表单验证时呈现消息"Value is required and can't be empty"。我想更改该消息,但不知道在哪里更改。我知道,如果我在输入过滤器中定义了一个验证器,我可以在那里为我定义的验证器自定义消息。但是如果我离开'validators' => [],,如 ZF3 示例所示,消息在哪里定义?
return [
'input_filter_specs' => [
'foobar' => [
[
'name' => 'name',
'required' => true,
'filters' => [
[
'name' => 'Zend\Filter\StringTrim',
'options' => [],
],
],
'validators' => [],
'description' => 'Hello to name',
'allow_empty' => false,
'continue_if_empty' => false,
],
],
],
];
【问题讨论】:
标签: validation zend-framework3 zend-inputfilter