You have had your first bump into the wall of strictly linking views,
controller and model. I generally tend to link the views and
controller more and keep my models more loose. That is, I don't have a
problem with using ModelB in ControllerA.

I read that you want one click to save both Contact and related phone
numbers.
If so, I have a two things to offer (off the top of my head):

You can possibly just switch to $this->Contact->saveAll($this->data)
if your data is returned correctly from the form. Hint: one single
form. You can check the cookbook for the details on how to use
saveAll.

You can reach the PhoneNumber model like $this->Contact->PhoneNumber
and save data that way if you need to.






On Sep 7, 8:28 pm, BrAt <mrasik...@yahoo.com> wrote:
> Hi , i am new to cakePHP , in order to learn php i am just making my
> first test application which is
> a simple telephone directory.
> in my database there are two entities named contacts and phone_numbers
> which has One-to-Many relationship.
>
> Now i have a form in contacts view "add.ctp" , i want that single form
> to add Contact as well as the numbers. so by clicking add button
> Contact, data should be stored in contacts table and phone number
> should be stored in phone_numbers. i have added another form for phone
> number and i m dynamically adding fields for input of phone number
> using javascript.
> But when the user clicks add button the data we put in phoneNumber
> form also goes to ContactsController,
>
> Now is there any way to send my PhoneNumber data to
> PhoneNumbersController to add action ,so that i can save that data in
> phone_numbers table. or any other way to do this job.
>
> i ll be really thankfull.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to