I tend to use:
$this->set('selectedTopics', $this->Topic->generateList());
which creates a list that is usable in a select dropdown right away. note
the absence of 'id' in the function call which makes array_reverse
unnecessary i believe.
[EMAIL PROTECTED] wrote:
>
>
> Try this in your controller:
>
> $this->set('selectedTopics',
> array_reverse($this->Topic->generateList('id')));
>
> Then in your view:
>
> $html->selectTag('Topic/Topic', $topics, $selectedTopics,
> array('multiple' =>
> 'multiple'))
>
> I believe that is how I solved it in the past. The select tag expects
> the ids to be in the keys of the array, so you have to use
> array_reverse.
>
>
> >
>
>
--
View this message in context:
http://www.nabble.com/How-to-make-HABTM-edit-pages-auto-select-selected-items--tf2740645.html#a7664616
Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---