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;
}