the best way to do this is using generateList in your controller - see
the model functions in the manual. I have one which looks like this:

view:

<?php echo $html->selectTag('Review/cruiseline', $cruise_lines, null,
array(), null, true, false);?>

controller:

$this->set('cruise_lines', str_replace( '&amp;','&',$this->CruiseLine-
>generateList(null,'cruise_line_name ASC',null,
'{n}.CruiseLine.id','{n}.CruiseLine.cruise_line_name')));

generateList puts your data int key/value pairs.




On 5 Mar, 23:19, "Gerry" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm a cakephp newbie and i'm having some trouble with showing the
> right datafield in a selectbox.
>
> I'm having a table srt_location which has 2 fields: id & description.
> This table has a relation with the table Location, which has a field
> srt_locations_id. Now, when I use the selectTag in my add.thtml, the
> select box shows the id, instead of the description. This is the code
> I use:
>
> <?php echo $html->selectTag('Location/srt_locations_id',
> $SrtLocations, $html->tagValue('Location/srt_locations_id'), array(),
> array(), true);?>
>
> Does anyone know how I can display the description field in the
> selectTag???
>
> Thanks in advance..
>
> Gerry.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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