Thanks, that makes sense. So to get the data into a format like it is
in your example, I've reverted back to how I was making the form
earlier. Instead of adding multiple type elements like this:

echo $form->input('Category.multi_field', array(
  'options' => $categories,
  'label' => 'Categories',
  'multiple' => 'checkbox',
  'error' => array(
    'required' => 'Please choose at least one category.'
  )
));

I'm now doing it like this again (which looks like a way that Cake
understands, because I don't have to specify what the options are
anymore - it can work it out automatically):

echo $form->input('Category.Category', array(
  'label' => 'Categories',
  'multiple' => 'checkbox',
  'error' => array(
    'required' => 'Please choose at least one category.'
  )
));

This still doesn't work, but in a slightly more promising way. In my
quick test example, I'm trying to set a category pairing of category 4
with product 6, colour pairings of 4 and 8 with product 6, and size
pairings of sizes 1, 2, and 3 with product 6.

The problem is that it seems to be carrying across the other models'
pairings, so instead of category 4, colours 4 and 8, and sizes 1, 2,
and 3, it tries to insert a category of 4, colours of 4, 4, and 8, and
sizes of 4, 4, 8, 1, 2, and 3. So I'm getting duplicate errors.

28 INSERT INTO `categories_products` (`product_id`,`category_id`)
VALUES (6,4)

31 INSERT INTO `colours_products` (`product_id`,`colour_id`) VALUES
(6,4), (6,4), (6,8) 1062: Duplicate entry '4-6' for key 1

34 INSERT INTO `products_sizes` (`product_id`,`size_id`) VALUES (6,4),
(6,4), (6,8), (6,1), (6,2), (6,3) 1062: Duplicate entry '6-4' for key
1

So is there anything I can do to reset or clear the values in any way
in between it saving all the different models automatically?

Thanks,
Zoe.
--~--~---------~--~----~------------~-------~--~----~
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