Yii Framework Forum: Radiobuttonlist. Error: Object Of Class Assesstmenttmp Could Not Be Converted To String - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   Azma 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 04-July 13

Posted 20 July 2013 - 07:55 AM

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..
0

#2 User is offline   FreeScott 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 31-December 12

Posted 22 July 2013 - 01:13 PM

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'=>''
   )
)

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users