I have a model called Item (model, views, controller) in my add method
reached by localhost/item/add, I would like to give the user the
ability to create a new ItemList db record from the Item add form.  I
currently am using the following form code (add.thtml):

<label>List:</label>
<?php echo $html->inputTag('ItemList/name', array('size' => '64')) ?>
<?php echo $html->tagErrorMsg('ItemList/name', 'List must be less than
64 characters') ?>

The following code in the add method of the ItemController:
        function add() {
                if (!empty($this->data)) {
                        if ($this->Item->validates($this->data)) {
                                        $this->Item->save($this->data);
                                        $this->redirect('/item/index');
                                }
                } else {
                        $this->validateErrors($this->Item);
                }
        }

It doesn't save the ItemList object, I have also tried trying to save
the ItemList explicitly using:

                $this->Item->save($this->data['ItemList']);

If I change it to the following it generates and error, that ItemList
is null:

                $this->ItemList->save($this->data);
and
                $this->ItemList->save($this->data['ItemList']);

Nothing works.

I am new to Cake, so still working through the fundamentals.

Any help would be greatly appreciated.

-John


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to