0

I am trying to set up a Display page which shows a Node and all the comments on it. Because I don't really like Node Displays / Views and prefer to have absolute control over what I'm outputting, I am trying to use the drupal_get_form('comment_node_post_form', $c) to place forms for Comments on my page.

I also want to support threading, to a certain degree. I have placed multiple Comment Forms on my page. Some of the forms have the comment's PID set, so that threading will be supported.

For some reason, though, the Parent ID never stays after submission.

Is this because I have multiple forms on the same page? How can I get around this?

  • 1
    I don't know what $c is, or where it comes from, but it could be because the form id's are all the same. Indeed overwriting certain values. Try to implement hook_form_alter() and then add drupal_set_message($form_id); It should give you an id per form. If they are the same that's your problem. A solution might be found here: stackoverflow.com/questions/2831273/drupal-form-with-custom-id – Neograph734 Dec 9 '13 at 23:45
  • Ah, I forgot to come here to say what had happened. You are correct! The Form IDs were all the same, so I used a similar answer that I found elsewhere, using hook_form_alter to re-assign forms of varying names (i.e. they all start with comment_form, such as comment_form_comment_nid_55_cid_40) to the form that they should call (i.e. comment_form) with the correct information (i.e. the parent ID of the comment). – tigertrussell Dec 10 '13 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.