How to load the comment form result inside the same lightbox after it is submitted?

223 views Asked by At

I have loaded a comment form in a view using this code:

$comment = new stdClass;
$comment->nid = $row->nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);

And to open the form in lightbox2:

<a href="*url* #form-inner" rel="lightmodal" class="lightbox-processed">Add a review</a>

It works fine and I am displaying this form in a lightbox using lighbox2 module.

My problem is that when the form is submitted, the entire page is loaded and would redirect to the comment node form which is site_url/comment/reply/node_id

What I wanted to do is if there is an error message on the form, it will remain in the same lightbox that will open and just display the error messages and for a successful submission, it'll also remain on the same form an display a success message.

I have tried rules but it still doesn't seem to work as the page is still being redirected.

1

There are 1 answers

0
jospratik On

Facing the same problem,

But i think https://www.drupal.org/project/modal_forms this module can do the trick i.e. displaying the comment form inside a popup.

you can visit the page and see that it supports this form.