I can’t seem to figure out how to render the ‘Type’ value from a dropdown list that has a FK in the details view (_view). It returns the ID # - I want it to return the ‘Type’ value instead.
If you have your relations well written, then it is just a matter of calling the relation and the value
Assuming model SportType [id,name]
// on model Team
public function relations(){
return array(
'sport'=>array(self::BELONGS_TO, 'SportType', 'sporttype_id'),
);
}
// then on your view
<b><?php echo CHtml::encode($data->getAttributeLabel('sporttype_id')); ?>:</b>
<?php echo CHtml::encode($data->sport->name); ?>
<br />