Quick reply! Got a meeting in 2 minutes...
Then do $this->redirect(array('controller' => 'subordinates', 'action' => 'add', $id)); (/subordinates/add/<id>) (function add($id=null) { .. } )
In subordinates, check if $id is set and if it's a valid person, if so - find the persons name, add it to your view for the user to see they are adding subordinates to that particular person.
Have the form submit to the same URL (/subordinates/add/<id>) and when saving it, if the id is present manually do $this->data['Subordinate']['person_id'] = $id;
Hope that made sense!
On 1 March 2012 11:56, driss bounouar <bounouar.driss@gmail.com> wrote:
I have two models person and subordinate and I have the relationship person has many subordinate what I want to do is that when I add the person when I click the submit button I will be redirected to add subordinate to that exact person I don't want a combox to choose between people ??How could I do that ? and more specifically how could I hold the person Id and save it in the foreign key of subordinate ??I hope you understand what I meanthank you all--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Kind Regards
Stephen
http://www.ninjacodermonkey.co.uk
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment