Checkboxlist Throws "array To String Conversion"


(Holyandor) #1

Im tryin to create a checkBoxList which depends on model data, so i basically added this line to my view


<?php echo $form->checkBoxList($model,'name', CHtml::listData(Places::model()->findAll(),'name','name')); ?> 

and Im gettin an exception like


Array to string conversion

Due to the doc. I just have to provide an string array, so I cant figure out, whats goin on here

Thanks in advance


(Saurabhdhariwal737) #2

You need to change your code as follows:


<?php echo $form->checkBoxList($model,'name', CHtml::listData(Places::model()->findAll())); ?> 

Hope this helps!

Thanks,

Saurabh Dhariwal