First, thanks for a great-looking module. I've been having some trouble though: when I activate AJAX forms on my node comment creation form everything seems to work when I go to create content->node comment, but when I embed the form into a node template using the code below, the ajax functionality ceases to work: when I click the submit button the button text changes to "loading," but nothing ever happens. The node is being created, because when I reload the page it's there.

print $comment_form = nodecomment_form($node);

Is this not the correct way to embed a form? Any help would be much appreciated!

Comments

brendoncrawford’s picture

Davidlerin,

Thanks for your feedback. I will have a look this weekend.

-brendon

brendoncrawford’s picture

Assigned: Unassigned » brendoncrawford
Priority: Critical » Minor
Status: Active » Closed (won't fix)

The correct way to embed a comment form is:

print comment_form_box(array('nid' => $node->nid));

Using this method, I was able to get AJAX Forms to work fine with the comment box.

Thanks,
Brendon

jordanmagnuson’s picture

Status: Closed (won't fix) » Active

Hey Brendon, thanks a lot for the quick response! I'm sorry for not making this completely clear in my original post, but I am not trying to embed a comment box in my node template: I am trying to embed the nodecomment_form from the Node Comments module: in other words, a full node creation form (the form I see when I go to Admin->Content Management -> Create Content -> Node Comment). I've looked all over, but have had a very hard time finding anything helpful on the subject of embedding a node creation form... print $comment_form = nodecomment_form($node) seemed to work, so I figured that was the way to do it... but maybe not? So I still don't know if the issue here is with your module, or with the method I used to embed the form.

Thanks again for your help--very much appreciated; and I am sorry about the lack of clarity in my original post.

Jordan

jordanmagnuson’s picture

After looking at http://drupal.org/node/261495 I tried:

	$new_nodecomment = new stdClass();
	$new_nodecomment ->type = 'comment';
	module_load_include('inc', 'node', 'node.pages');
	$output = drupal_get_form('comment_node_form', $new_nodecomment);
	print $output;

Again, the form was printed on the page as expected, with no errors (this time it even had a settings box that was not printed using my previous method, so it now looks exactly as it does when I go to the node creation page), but again, when I push the submit button after enabling Ajax Forms, it just sits there on "Loading...".

brendoncrawford’s picture

Priority: Minor » Normal
Status: Active » Fixed

Davidlerin,

This has now been fixed in 6.x-1.x-dev. Please wait up to 12 hours for the latest dev package to update. Also, the correct way to display a node creation form would be:

require_once "modules/node/node.pages.inc";
print node_add('SomeNodeType');

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.