Skip to content

Instantly share code, notes, and snippets.

@bendi
Created February 28, 2011 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bendi/847913 to your computer and use it in GitHub Desktop.
Save bendi/847913 to your computer and use it in GitHub Desktop.
Zend_Form_Decorator_JsValidation - adding custom validator (PHP side)
<?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