problems populating my select box
Hi there, newbie here.
I have a campaign model and a charity model. Campaign belongsTo
Charity and Charity hasMany Campaigns.
I have a form which creates a campaign and I need a select box to have
the name of all the charities. What I have at the minute is what cake
baked for me and it creates a select box for the charities but it has
their ids rather than the charity's name.
From the documentation I changed it to:
in the controller:
$users = $this->Campaign->User->find('list');
$charities = $this->Campaign->Charity->find('list');
$this->set(compact('users', 'charities'));
in the view:
echo $this->Form->input('Charity.charity_name');
(I also tried)
echo $this->Form->input('Charity', array('type'=>'select',
'options'=>'$charities'));
but I can get neither to work. I've googled and not found an answer I
understand.
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home