View Single Post
  #2 (permalink)  
Old 07-28-2008, 12:15 PM
iongion iongion is offline
Junior Member
 
Join Date: Jul 2008
Posts: 2
Thumbs up how to

You must override your isValid function and manipulate the decorators there, basically you need to manipulate the HtmlTag decorator of the item with error and setOption('class', 'error')

sample:
PHP Code:
     public function isValid($formData) {
          
$isValid parent::isValid($formData);
          if(!
$isValid) {
               
$errors $this->getErrors();
               foreach(
$errors as $fn => $error) {
                    if(empty(
$error)) continue;
                    
$el $this->getElement($fn);
                    
$dec $el->getDecorator('HtmlTag');
                    
$dec->setOption('class''witherrors');
                }
           }
           return 
$isValid;
     } 
Reply With Quote