Generate RadioButtonList
echo CHtml::RadioButtonList('id', '', array('student'=>'Student','employee'=>'Employee'));
will generate:
<input value="student" id="id_0" type="radio" name="id">
<label for="id_0">Student</label>
<br>
<input value="employee" id="id_1" type="radio" name="id">
<label for="id_1">Employee</label>
Other tricks:
Display them inline without '<br>' separator:
echo CHtml::RadioButtonList('id', '', array('student'=>'Student','employee'=>'Employee'),
array('labelOptions'=>array('style'=>'display:inline'), separator'=>''));
No comments:
Post a Comment