I was using non-automagical form fields on my form, and because of
that, this was left out:

<input type="hidden" name="data[Niche][Niche]" value=""
id="NicheNiche" />

Once I put that in there, it worked fine.


On Dec 23, 6:37 am, tekomp <[email protected]> wrote:
> Hi,
>
> I have a form which is saving data to a join table using the method
> found 
> here:http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...
>
> The data saves, but each time I submit the form, it doesn't delete the
> existing relationships in the join table before adding new ones so the
> join table keeps on growing.  Both of my models (niche and website)
> have "'unique' => true" in them, so I'm not sure why it's not first
> deleting the existing data.  My join table consists of the following
> fields:
>
> id
> niche_id
> website_id
> primary_secondary
>
> Snippet from website model:
>
>         var $hasAndBelongsToMany = array(
>                 'Niche' => array(
>                         'className' => 'Niche',
>                         'joinTable' => 'niches_websites',
>                         'foreignKey' => 'website_id',
>                         'associationForeignKey' => 'niche_id',
>                         'unique' => true
>                         )
>                 );
>
> Niche model is setup like that also, but opposite values to correspond
> to the the website model.  Any ideas on why it's not removing existing
> data before inserting new values?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to