Getting Proper Label From A Foreign Table

hi all

I’ve done this before but for some reason now I can’t get it to work

I have a table (province) which has three fields (id,abbreviation_en and abbreviation_fr )

I have another table (registration) that has a province_id field which will containt the ID from the province table

in my form I do this

echo $form->labelEx($model,'province_id');

 echo CHtml::activeDropDownList($model,'province_id', CHtml::listData(province::model()->findAll(), 'id', 'abbreviation_'.getLang().''),array('prompt'=>Yii::t('general','-- Choose One --')));

     echo $form->error($model,'province_id');

that works and the proper ID gets stored into my registration table

the problem I’m having is displaying the actual name in my views

I’m using the following code but all I get is NOT SET for the value

any idea what I may be missing??

<?php $this->widget('bootstrap.widgets.TbDetailView',array(











		array('name' => 'province_id.abbreviation_'.getLang().'', 'label'=>'Province'),










)); ?>

I’m using pretty much the same code in another side and it’s working there… one difference is that in the other one I simply put province.abbreviation_ instead of province_id.abbreviation_

Instead of ‘province_id.abbreviation’ don’t you have to use the relation name plus abbreviation?

hahaha… I knew I was forgetting something basic! yup… just had to add this in my relations inside my registration model

thanks :)

	public function relations()


		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

		 'province' => array(self::BELONGS_TO, 'province', 'province_id'),