Tuesday, December 6, 2011

Dropdown list is empty

I have an email add view with a dropdown list for a field called
to_user_id (relating to the users table). The problem is that the
dropdown list is empty. Here is code from the controller:

$recipients = $this->Email->Recipient->find('list');
$this->set(compact('recipients'));

...and in the add.ctp file:

echo $this->Form->input('to_user_id');

I don't know if this makes a difference but in the users model:

var $displayField = 'username';

In the email model:

var $belongsTo = array(
'Recipient' => array(
'className' => 'User',
'foreignKey' => 'to_user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
...

Any ideas as to why the dropdown list is empty?

Thanks.

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: