Create a form on your posts view. Include a hidden field with the value of the
post id (echo $this->Form->hidden('post_id', array('value' =>
$this->data('Post.id')); ). When the form is submitted (by clicking the submit
button inside the form) you should find the Comment.post_id field is populated
with the right id (die(debug($this->data)); to check it out). Then all you need
to do inside your Post's controller is
$this->Post->Comment->save($this->data['Comment']); I have just typed that,
not tested it, but it ought to work. If not. it'll be close enough.
Jeremy Burns
[email protected]
On 29 Mar 2010, at 14:13, dole.doug wrote:
> I have two classes: Post and Comment.
>
> I wish to have the comment form on each post and if somebody press the
> submit button of a comment, that comment to be subscribed to that
> post.
>
> How can i do that?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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
To unsubscribe from this group, send email to
cake-php+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.