Created
February 28, 2011 19:57
-
-
Save bendi/847913 to your computer and use it in GitHub Desktop.
Zend_Form_Decorator_JsValidation - adding custom validator (PHP side)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Form_Decorator_JsValidation extends Zend_Form_Decorator_JsValidation | |
{ | |
const ORDER_MY_CUSTOM = 100; | |
protected function handleCustomValidators($name, $msgs, $validator) | |
{ | |
switch($name) { | |
case 'MyCustomValidator': | |
return array( | |
self::ORDER_MY_CUSTOM, | |
array( | |
'param' => $validator->getParam() | |
), | |
array( | |
'notValid' => $msgs[MyCustomValidator::NOT_VALID] | |
) | |
); | |
default: | |
return parent::handleCustomValidators($name, $msgs, $validator); | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment