I have a drop down list but I the text value is dependent on another value from the same model.
What I want to happen is if the row from a model has a client_type_id
value of 1
then the drop down text should be company_name
else it will be the first_name
. Kindly refer to the code below.
<?php echo $form->dropDownListRow($model , 'client_id', CHtml::listData(Client::model()->findAll(), 'id', '$data->client_type_id == 1 ? $data->company_name : $data->first_name')); ?>
Is it even possible to achieve it like this?