CHtml::listdata(), concatenating values?

I’m using CHtml::activeDropdownList() to generate - yes, a dropdown list.

Now, I’m loading all the values fine like so:




<?php echo $form->dropdownList($model,'user_fk',CHtml::listdata(User::model()->findAll(),'user_oid','last_name')); ?>

But, I don’t want the value to be just ‘last_name’, I want it to be ‘first_name’ concatenated with ‘last_name’. CHtml::value() seems to say

is all I need to do, but doing


...->findAll(),'user_oid','first_name'.'last_name'));

doesn’t work, or any variation on that I’ve been able to decipher.

What am I doing wrong here? I feel stupid for asking, but have spent quite a bit of time trying to find out what I missed…

there is a lot question like this if you search and already solved.

btw, try this

in your user model add this function




	public function getFullname()

	{

		return $this->first_name  . ' ' . $this->last_name;

	}



in your view




<?php echo $form->dropdownList($model,'user_fk',CHtml::listdata(User::model()->findAll(),'user_oid','Fullname')); ?>



if im not miss typo…