hi, I want to make a SELECT item with the result of a query, I have this in the view:
echo $this->Form->input('person_id');
I want the value to be the person's id, and display the concatenation of firstname and lastname, like so:
<select id="ResearchGroupPersonId" name="data[ResearchGroup][person_id]">
<option value="2">lastname2 firstname2</option>
<option value="1">lastname1 firstname1</option>
</select>
I tried this is the controller without success
$people = $this->ResearchGroup->Person->find('list',
array(
'fields' => array('Person.id', 'CONCAT (Person.lastname, " ", Person.firstname) AS fullname'),
'order' => array('Person.lastname'),
)
);
the sql log show that rows are retreived, they just don't get displayed. It works witout the concatenation, this:
$people = $this->ResearchGroup->Person->find('list',
array(
'fields' => array('Person.id', 'Person.lastname'),
'order' => array('Person.lastname'),
)
);
gives this
<select id="ResearchGroupPersonId" name="data[ResearchGroup][person_id]">
<option value="2">Doe</option>
<option value="1">Ray</option>
</select>
Why's that?