Yii Framework Forum

bootstrap required field in Textfield


(Winson Kong) #1

Hi all,

Actually i want to do like this

<input type="text" class="form-control" name="InputCode" id="InputCode" placeholder="Enter Code" required>

but try in Yii textfield is does’n work

$form->textField($userEntity,‘f_name’,array(‘class’=>‘form-control’,‘placeholder’=>‘New Member’,‘required’=>’’));


(Pawel) #2

Your post is in wrong section.

Anyway, in Yii 1.1 you can do it like that:


'required' => true

If you don’t want this to be rendered


required="required"

you must set renderSpecialAttributesValue to false.