Hi Mario,

I have similar situations in my application and I guess there is no automatic 
way to do it.

So what I do is get the data wth all fields and loop through them and create 
another array with value = id and shown sring firstname + family name.

If there is a more elegant solution I don't know it.

Anja


-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von mario
Gesendet: Sonntag, 26. Oktober 2008 16:09
An: CakePHP
Betreff: concatenation in find('list')


Hi guys,

I have this following code snippet from my controller:

$salespeople = $this->Campaign->Salesperson->find('list',
                                  array('order' => 'Salesperson.firstname ASC',
                                          'fields' => array('Salesperson.id', 
'Salesperson.firstname')));


In my view, I have this following line:

echo $form->input('salesperson_id');


This codes would create a combobox in my view that would have a key: 
salesperson.id and value: salesperson.firstname


Now here is what I want to do:

I also have a field 'lastname' under my salespeople table and I want it to be 
concatenated to the salespersons'
firstname (with a space between the firstname and lastname).

I can't just have the firstname in my combobox because there is a high 
possibility that there would be duplicates for firstnames.
It would be better if firstname and lastname would be displayed in my view's 
combobox and still would match to a corresponding salesperson.id.

Is there a way to do this?


Thanks,
Mario


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to