php - Zend_Input_Filter - how to add several validators to 1 data field -
What is the correct way to specify some assumptions of the same data field when using Zend_Input_Filter.
For example, my validators array is this and I need assumptions on field 2:
$ validators = array ('Field1' = & gt; array ('NotEmpty', 'messages' = & gt; 'Field must be 1' field 2 '= & gt; array (' NotEmpty ',' messages '= & gt;' Field 2 must be selected '),' field 2 '= & Gt; array (' numerals', 'message' = & gt; 'field must be numeric'),);
then I call
< Pre> $ input = new Zend_Filter_Input (zero, $ validators, $ data);
But I think I'll call the array key ' If you can not use the Wild 2 'twise, then how do I pack the valators for just one field?
PS Okay, I know that distributing all class Vedicities in one class is a difficult route, But I hope this is easy and in a ZF manner, the configuration method.
$ validators = Array ('field1' = & gt; array ('NotEmpty', 'digit', new Zend_Validate_Blahblah (), 'message' = & gt; Array ('field must be filled', 'field must be 1 numeric', 'field 1 must be a blank')), ...);
Give it a read:
Comments
Post a Comment