I cannot get an model with a HABTM relation to another model to save
its relation data.  I can see *why* this is happening, but I'm not
sure how to fix it.  Read on, and I'll explain.

The models and "User" and "Zone".

In my edit view for User, I have this:

<?php echo $html->selectTag("Zone/Zone", $Zones, null,
array('multiple' => 'multiple')); ?>

This results in a tag of:

<select name="data[Zone][Zone][]"  multiple="multiple" id="ZoneZone">

So this means that when the form posts back into the controller, $this-
>data will look like this:

$this->data['User'] = [stuff...]
$this->data['Zone'] = [stuff...so the Zone selections are in this
element]

IMPORTANT: The submitted User data and the submitted Zone data are in
different elements.

However, according to all the doc I've been following, when I actually
save the data, I'm supposed to do this:

$this->User->save($this->data['User'])

That's strikes me as not workable on the surface, since I'm not
passing the 'Zone' element of the data array to the save() method.  So
the model can't save the relationships because I'm not giving it the
relationships.

So, when I save, what should I pass the save() method of the user
model so it gets the inputted Zone associations?

Deane


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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