使用config时无法覆盖默认的Zend Email错误消息

时间:2014-02-17 18:43:34

标签: forms validation email zend-framework

使用ini文件配置Zend(1.12)表单,我在尝试覆盖默认电子邮件时遇到问题。配置如下:

elements.emailAddress.type = email
elements.emailAddress.options.label = "Email Address"
elements.emailAddress.options.required = true
elements.emailAddress.options.maxlength = 255
elements.emailAddress.options.validators.required.validator = NotEmpty
elements.emailAddress.options.validators.required.options.messages.isEmpty = "An email address is required"
elements.emailAddress.options.validators.email.validator = EmailAddress
elements.emailAddress.options.validators.email.options.messages.emailAddressInvalidFormat = "Please enter a valid email address"
...

虽然我能够以这种方式覆盖isEmpty消息,但emailAddressInvalidFormat消息仍为默认"'xxx' is not a valid email address in the basic format local-part@hostname"

1 个答案:

答案 0 :(得分:0)

假阴性!我正在使用扩展库类来添加HTML5表单元素(例如电子邮件),这些元素添加了自己的电子邮件验证程序,该验证程序覆盖了我配置的验证程序!