Zend_Form validator question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
georgeoc
Forum Contributor
Posts: 166
Joined: Wed Aug 09, 2006 4:21 pm
Location: London, UK

Zend_Form validator question

Post by georgeoc »

Hi.

I'm configuring a Zend_Form object from an ini file. One element has this configuration:

Code: Select all

; userEmail element
elements.userEmail.type = "text"
elements.userEmail.options.label = "Email address"
elements.userEmail.options.required = "true"
elements.userEmail.options.validators.emailaddress.options = "EmailAddress"
 
I can't work out how to control some of the flags available to the Email Address validator, such as Zend_Validate_Hostname::ALLOW_DNS, Zend_Validate_Hostname::ALLOW_LOCAL and the methods like setValidateIdn() on the Zend_Validate_Hostname class.

Is it possible to control all these using my ini file?
georgeoc
Forum Contributor
Posts: 166
Joined: Wed Aug 09, 2006 4:21 pm
Location: London, UK

Re: Zend_Form validator question

Post by georgeoc »

I've found I can use:

Code: Select all

elements.userEmail.options.validators.emailaddress.options.allow = 7
...where 7 is the current value of Zend_Validate_Hostname::ALLOW_ALL. This has the result I'm looking for.

However, it is a nasty hack. Is there a way to specify this correctly in the config file?
Post Reply