The variable should be called $mediaTypes, so do
$this->set(compact('mediaTypes')); instead.
Also, consider going to the MediaType model and setting var $displayField =
'type'; - then you don't need to specify the fields in the find; a simple
$mediaTypes = $this->Media->MediaType->find('list'); will do.
On 20 Jun 2011, at 06:16, CRUSH wrote:
> Hey,
> I have spent hours troubleshooting this stupid problem. Tried many
> combinations of names. This code gave me a select box with the media
> types in the view in version 1.2. In version 1.3 it gives me an empty
> select box. By debugging the "$media_types" I can see that the Find
> call is getting the correct rows but that's as far as I know how to
> debug. Any thoughts?
>
> :::: Controller ::::
> $media_types = $this->Media->MediaType->find('list',
> array('fields'=>array('MediaType.id', 'MediaType.type')));
> $this->set(compact('media_types'));
>
> :::: View ::::
> echo $form->input('media_type_id', array('label' => 'Media Type'));
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php