Any way to change the tag of error() in CActiveForm?

Hi everyone.

In default, CActiveForm::error() display an error in <div> tag besides some input tag. Sometimes I want to use <span> instead of <div>, but it seems the source code of this method has fixed using div tag:(

In CHtml::error():

return self::tag('div',$htmlOptions,$error);

So how can I change the tag without touching the framework’s source code?

Do I have to use some css (like


) to solve it?

Thanks. Sorry for my English:)

Hm, I understand your problem as I had the same issue when using CForm which is using hard coded divs for representing rows in a form. I was able extend CForm to override the specific method but I don’t think there is an elegant way to extend CHtml this way because it isn’t itself extending CComponent so you will have to use CSS here. display: inline sounds right, have you tried it?

Btw I think this could be a feature request: Make CHtml an application component allowing customized classes like it is possible with CFormatter