Make sure your associations aren't backwards.
Read http://book.cakephp.org/view/66/models#associations-78 ,
compare foreignKey for hasOne and belongsTo.
On 20 Jun 2008, at 09:34, Turnquist, Jonah wrote:
>
> I have a 'entries' table and a 'categories' table. I am creating an
> 'add' page to add a new entry, and I want to be able to select the
> category that the entry goes into.
>
> View:
>
> <h1>Add Entry</h1>
> <?php
> echo $form->create('Entry');
> echo $form->input('category_id');
> echo $form->end('Submit');
> ?>
>
> Model:
> <?php
>
> class Entry extends AppModel
> {
> var $hasOne = 'Category';
>
> var $validate = array(
> );
>
> }
>
> ?>
>
> Category modal:
> <?php
>
> class Category extends AppModel
> {
>
> var $validate = array(
> );
>
> }
>
> I want the add page to show a drop down menu of all the availiable
> categories in the categories table, what am i doing wrong?
>
> Thanks,
> Jonah
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---