使用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"
答案 0 :(得分:0)
假阴性!我正在使用扩展库类来添加HTML5表单元素(例如电子邮件),这些元素添加了自己的电子邮件验证程序,该验证程序覆盖了我配置的验证程序!