On your Service add.ctp, you reference the phone 1 and two like:

Addressbook.1.phone
Addressbook.2.phone

This causes cake to put them into an array of Addressbooks, which are
accessible in your model.

Then the saveAll should do its' magic.

On Nov 9, 4:43 pm, Lukas <[EMAIL PROTECTED]> wrote:
> Hi everyone :)
>
> This is the first time I had to use HABTM, and I'm facing a problem
> when I have to save data
>
> Lets say I have
>
> MODELS:
> class Service extends AppModel
> {
>         var $hasAndBelongsToMany = array( 'Addressbook' );
> );
>
> class Addressbook extends AppModel
> {
>         var $hasAndBelongsToMany = array ('Service');}
>
> Addressbook: id, phone, ...
>
> CONTROLER:
> function save() {
>                 $this -> Service -> id = $this -> data['Service']['id'];
>
>                 $this -> Service -> save($this -> data);
>
> }
> >> How does add.ctp should look like if e.g. I want to add a Service record 
> >> with 2 new  phone numbers?
>
> Sketch of result
>
> Title {Service.title}
> About {Service.about}
> Phone Number 1 {Addressbook.phone.}
> Phone Number 2 {Addressbook.phone}
>
> I've tried many (I hope I don't have to post them all here :) )
> combinations of $form helper usge, but I could get wanted result :(
>
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
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