views:

17

answers:

1

Zend Framework defaultly looks for validators only in this path:

Zend_Validate_: Zend/Validate/

How can I make it look also in, for example:

My_Validator_: My/Validator/

I can't find anything about this problem in the documentation.

+3  A: 

Should be

$element->addPrefixPath('My_Validator_', 'My/Validator', 'VALIDATE');
// even better whould be:
// $element->addPrefixPath('My_Validator_', 'My/Validator', Zend_Form::VALIDATE);

To do it at the form level, it should be:

$form->addElementPrefixPath('My_Validator_', 'My/Validator', 'VALIDATE');
// even better would be:
// $form->addElementPrefixPath('My_Validator_', 'My/Validator', Zend_Form::VALIDATE);
David Weinraub