Hi I have a question about the finder and Form->control.
I have a Post which contains clients. So far so good.
In my add method, I put in there a list of clients
On my template, I have a form where I have a option select where I can choose clients.
echo $this->Form->control('client_id');
But when I have a look on the Posts/add site, then I see the option list just only the name of the client. But I want to display in this field, name and prename.
Is there a possibility to put these additional info to the form control?
Thanks
Hi dirk, thanks for your fast answer. I think I will try this find(fields) what is described in your link.
But on template, there is nothing to change?
The view uses whatever is in $clients as an array of key-value pairs. The list finder gives you an array of key-value pairs, where the key is the ID and the value is the display field (typically name, for example). If you want the value to be different, you have to make that happen in your controller. Retrieving Data & Results Sets - 5.x shows an example of how to do that.
I tried it like described on the page
find(ālistā, keyField: āidā, valueField: āauthor.nameā)
But it is same as before, I have an ID and a name which is shown. But I need 2 Fields displayed.