开发者

where can I find a list of all the validators and filters of a Zend_Form?

开发者 https://www.devze.com 2023-03-10 08:06 出处:网络
I\'m learning Zend Framework using their manual at framework.zend.com. where can I find the full list of all the validators and filters

I'm learning Zend Framework using their manual at framework.zend.com.

where can I find the full list of all the validators and filters that can be used in a Zend_Form ?

Using Zend Framework 1.11.6.

example:

开发者_Python百科
filters: 'StringTrim' 

validators: 'EmailAddress'

thank you!


Check the following paths of your Zend Framework installation folder:

/Zend/Validate/*
/Zend/Filter/*

Or check the corresponding manual pages:

http://framework.zend.com/manual/en/zend.filter.html

http://framework.zend.com/manual/en/zend.validate.html


You can use all the shipped filters & validators with zend-form aswell as custom ones.


The usage, for anyone that got a little confused as I did, is to take the last part of any Zend_Validate_XYZ and use the XYZ as the string in any addValidator chain like so: ->addValidator('XYZ') so for example, to validate an email address use the Zend_Validate_EmailAddress class or ->addValidator('EmailAddress') on the elements variable

Don't forget that the second parameter is whether a failure should break the chain. True breaks the chain, False does not. So, if we wanted to validate an Alpha only field and then an AlphaNumeric field but NOT break if the Alpha field !isValid() then: ->addValidator('Alpha', FALSE)->addValidator('AlNum', TRUE)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号