Re: using more than one model in a add_new view

2006-05-03 Thread Chris Cassell
To send it in an array, you have to either hack the $html->input fieldname parameter: echo $html->input ('Deposit/0][inicial'); echo $html->input ('Deposit/0][final'); echo $html->input ('Deposit/1][inicial'); echo $html->input ('Deposit/1][final'); (This is ugly, but should work--double check the

Re: using more than one model in a add_new view

2006-05-02 Thread Carlos Mauricio Samour
Exelent! Thanks for the helpfull tip! I am really impresed by the level of help and support I have received from the Cake comunnity. Another question It might be a litle off topic. If in a view I have. First Deposit input('Deposit/inicial');?> input('Deposit/final');?> Second Deposit input('Depo

Re: using more than one model in a add_new view

2006-05-02 Thread [EMAIL PROTECTED]
Just wanted to say thanks for posting this. I have been beating my head against this problem for hours, as I usually prefer to make a single form that saves all associated models at once. This saved me a lot of time! I'd vote that this should probably be added to the manual or wiki somewhere, s

Re: using more than one model in a add_new view

2006-05-01 Thread huy
Carlos Mauricio Samour wrote: > How do I save more than one ModelB at te same time? > > Hi Carlos and everyone. I am totally enjoying baking with Cake and thought I could throw in my 2 cents and help out. And I hope to get an answer on some of the questions I have posted in the past :) So Car

Re: using more than one model in a add_new view

2006-05-01 Thread Carlos Mauricio Samour
Thanks You really have been of great help! On 5/1/06, Chris Cassell <[EMAIL PROTECTED]> wrote: > > > > $this->ModelA->ModelB->save (array ('ModelB' => $modelb2)); > > $this->ModelA->ModelB->save (array ('ModelB' => $modelb3)); > > ..This code first saves the data of $modelb2 and then replaces it

Re: using more than one model in a add_new view

2006-05-01 Thread Chris Cassell
> $this->ModelA->ModelB->save (array ('ModelB' => $modelb2)); > $this->ModelA->ModelB->save (array ('ModelB' => $modelb3)); > ..This code first saves the data of $modelb2 and then replaces it > with the data of $modelb3. How do I save $modelb3 to a new 'ModelB'? Add $this->ModelA->ModelB->create

Re: using more than one model in a add_new view

2006-05-01 Thread Carlos Mauricio Samour
How do I save more than one ModelB at te same time? On 5/1/06, Chris Cassell <[EMAIL PROTECTED]> wrote: > > I had to solve this problem myself. Here's what I do--perhaps not the most > elegant, but it does work. (This code is off the top of my head and may need > some tweaking) > > In your view s

Re: using more than one model in a add_new view

2006-05-01 Thread [EMAIL PROTECTED]
You don't have to do the $this->ModelA->ModelB->save(). You can simply put $this->ModelB->save(). Just make sure that in the model your method is in that your $uses variable has ModelB and ModelD included. But yes this is simliar to the solution that I used. And also similiar to the solution i

Re: using more than one model in a add_new view

2006-05-01 Thread Chris Cassell
I had to solve this problem myself. Here's what I do--perhaps not the most elegant, but it does work. (This code is off the top of my head and may need some tweaking) In your view set your inputs with their various modelname/fieldname name attributes: echo $html->input ('ModelA/date'); echo $html

Re: using more than one model in a add_new view

2006-05-01 Thread Scott Sharkey
Carlos Mauricio Samour wrote: > In the examples I read in the wiki using the add action I only see one > model being use. What is the best way of using more the one model that > uses hasMany reletionships into a view? > In my add_new form I want to use 3 models. > When I press the Save button it o

using more than one model in a add_new view

2006-05-01 Thread Carlos Mauricio Samour
In the examples I read in the wiki using the add action I only see one model being use. What is the best way of using more the one model that uses hasMany reletionships into a view? In my add_new form I want to use 3 models. When I press the Save button it only sends the data of the first model an