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(
'data'=>$model,
'attributes'=>array(
'id',
'f_name',
'l_name',
'phone_H',
'phone_W',
'phone_M',
'addr',
'city',
array('name' => 'province_id.abbreviation_'.getLang().'', 'label'=>'Province'),
'post',
'email',
'comments',
'dob',
'med_alert',
'emer_contact',
'emer_contact_phone',
'date_inserted',
),
)); ?>
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_