I have a table called User with a first name and last name field. I’d like to make an activeDropDownList which uses the user_id field as the key and the concatenation of first and last name as the value.
My attempt looks like this:
$criteria = new CDbCriteria;
$criteria->select = 'user_id, concat(first_name, " ", last_name) as name';
echo CHtml::activeDropDownList($model, 'primary_contact_id', CHtml::listData(User::model()->findAll($criteria), 'user_id', 'name'));
Says it can’t find field name in User. Any thoughts?