in my YII form i have a dropdown depending on a table to another table which saves the id of the depended table like below
<div class="column">
<?php echo $form->labelEx($model,'employee'); ?>
<?php echo $form->dropDownList($model,'employee',CHtml::listData(Employee::model()->findAllByAttributes(array('status'=>'Active')),'emp_id','emp_name'),array('empty'=>'select')); ?>
<?php echo $form->error($model,'employee'); ?>
</div>
from above the form will save emp_id of the emp_name.in grid view also it showing same id only.but i just need to display emp_name of corresponding emp_id and should saved as id in database.anyone have idea post i am new to this thanks in advance
In your grid view
And if relation to Employee model is defined in your model then you can use