Array to string conversion error for listData and activeRadioButtonList if $groupField parameter is passed

I’m not sure, but this seems to behave like a bug.

Region has many Market. I’m trying to display for each Region many Markets as radio buttons.

Using the code below with the parameter $groupField = ‘Region_id’ causes Yii 1.1.15 to crash.




$listData = CHtml::listData($data->markets, 'id', 'Market', 'Region_id');

echo CHtml::activeRadioButtonList($data->markets[0], 'id', $listData);



Array to string conversion


        public static function tag($tag,$htmlOptions=array(),$content=false,$closeTag=true)

157     {

158         $html='<' . $tag . self::renderAttributes($htmlOptions);

159         if($content===false)

160             return $closeTag && self::$closeSingleTags ? $html.' />' : $html.'>';

161         else

162             return $closeTag ? $html.'>'.$content.'</'.$tag.'>' : $html.'>'.$content;

163     }

The value of the variables are:

$listData = array(2 => array(1 => ‘MTN’, 2 => ‘PNW’), 3 => array(3 => ‘NCA’, 4 => ‘SCA’))

$content = array(1 => ‘MTN’, 2 => ‘PNW’)

I was just trying to have the Market radio buttons grouped by the Region so they don’t affect each other when clicked on them.

How do you guys usually program it with Yii? Is this a bug or just user error?