there is no title

Aug 05 2011

custom message for required input in zend framework

So, maybe there’s a better way to do it, but this is how i figured out how to set up a custom message in zend framework, for a required form element in the config file:

elements.firstname.type = "text"
elements.firstname.options.label = "First Name"
elements.firstname.options.required = true
; Use the next 4 lines to set a custom message when it's required
elements.firstname.options.allowEmpty = false
elements.firstname.options.validators.required.validator = "NotEmpty"
elements.firstname.options.validators.required.options.messages.isEmpty = "Can't be empty! nuh-uh"
elements.firstname.options.validators.required.breakChainOnFailure = true

72 notes

  1. swhfdn posted this
Page 1 of 1