Custom Textfield Type


I would like integrate my bootstrap with my Yii. I download extension, install but i would like keep my old layout text field.

When i explore my code, i saw that I have problem because yii set default type text in textfield, and my textfield is extends about bootstrap style.

Fortunately, I found a solution, and I think that one might be to think about it:

I create in CHtml class and in CActiveForm new method to set text field with not default value:


public function textTypeField($model,$attribute,$type,$htmlOptions=array())


    return Chtml::activeTextField($model,attribute,$type,$type,$htmlOptions);



public function activeTypeTextField($model,$attribute,$type,$htmlOptions=array())




    return self::activeInputField($type,$model,$attribute,$htmlOptions);


This resolve problem with integration Developer CSS style with Bootstrap Yii style.

How we can use ?




    $form->textTypeField($model,'$atrributes',[b]"userLogin"[/b], array(...));


This solution is tested, and my textfield style is imported :)

And what do you think about this solution, you may put it in Yii library?

Ok, i forgot to add that we must create new function activeInputField in CHtml.