Custom Validator With Custom Errorcssclass

Hello all,

I’m running into an issue with adding errorCssClass to a custom validator.

Example (taken from CActiveForm in view):

<?php echo $form->error($model, 'something', array('errorCssClass'=>'has-error')); ?>

This works just fine with any validation, except my custom validator.

My question is: How can I assign the errorCssClass to the custom validation?

My validator looks like this:

public function validateDateComplete($attrib, $params)


  if($this->date_complete < $this->date_start){

    $this->addError('date_complete', 'The complete date needs to be after the start date.');



I’m not able to pass the custom CSS to the parent <div> when I run this…Any ideas?

I solved this by just modifying my own custom CSS template. I assumed there wasn’t a function in Yii to address what I wanted to do. Either way, it’s the same result and the problem is fixed.