listData with ActiveRadioButtonList gives array for labels

Hi,

I am using a relationship wit "Question" has many "Answer".

I am trying to display for each Question a set of Answers with radio buttons:




$values = CHtml::listData($data->answers, 'id', 'answer', 'tridentQuestion.id');

echo CHtml::activeRadioButtonList($data->answers[0], 'id', $values)



I get only "array" for the labels.

What am I doing wrong?

Before the code was without the $groupField parameter in CHtml::listData().




$values = CHtml::listData($data->answers, 'id', 'answer');

echo CHtml::activeRadioButtonList($data->answers[0], 'id', $values)



The problem is, that for all questions the answers as radio button are one single group.

So when I click on the radio button in the first question it unselects all the other radio buttons from the other questions.

hi

try this




$values = CHtml::listData($model, 'id', 'answer');




Yes that’s how it was before and all radio buttons were treated as a single group.

I need them to be grouped.