Radiobuttonlist. Error: Object Of Class Assesstmenttmp Could Not Be Converted To String

more and more i created the ask post. i need for help… i’m completely newbie…

hello…

i use tabular input for collecting existed data (i tried this tutorial). i have this table in mysql database


mysql> desc assesstment_tmp;

+------------+--------------+------+-----+---------+----------------+

| Field      | Type         | Null | Key | Default | Extra          |

+------------+--------------+------+-----+---------+----------------+

| id         | int(11)      | NO   | PRI | NULL    | auto_increment |

| matakuliah | varchar(255) | NO   | MUL | NULL    |                |

| silabus    | varchar(255) | YES  | MUL | NULL    |                |

| level      | tinyint(1)   | YES  |     | NULL    |                |

+------------+--------------+------+-----+---------+----------------+

4 rows in set (0.01 sec)

in index page i have


<?php echo CHtml::activeTextField($items,'[$i]matakuliah'); ?>

<?php echo CHtml::activeTextField($items,'[$i]silabus'); ?>

<?php echo CHtml::activeTextField($items,'[$i]level'); ?>

i want on last input using radio button, then i edited to


<?php echo CHtml::activeTextField($items,'[$i]matakuliah'); ?>

<?php echo CHtml::activeTextField($items,'[$i]silabus'); ?>

<?php echo CHtml::radioButtonList($items,'[$i]level',array(0=>0,1=>1,2=>2,3=>3),array(

						'labelOptions'=>array(

							'style'=>'display:inline'),'separator'=>'')) ?>

but an error i have got


Object of class AssesstmentTmp could not be converted to string

please help me…

thank you in advance…

Hi, you should use activeRadioButtonList instead of radioButtonList and change its parameters accordingly, something like this:


echo CHtml::activeRadioButtonList(

   $items,

   '[$i]level',

   array(0=>'0',1=>'1',2=>'2',3=>'3'),

   array(

      'template'=>'{input}<div style="display:inline">{label}</div>',

      'separator'=>''

   )

)