4

I have configured comments to display in the node page, but if submit an invalid comment (e.g. without text in the comment field) I get redirected to the /comment/reply/ page. I would like to remain in the node page.

1 Answer 1

7

You can do this, by using hook_form_alter and then change the $form['#action'] value to point to the current destination.

3
  • I would appreciate if you could write what code exactly and where I have to put this.
    – john
    Commented May 26, 2011 at 23:10
  • 1
    I would appreciate if you write what code exactly and where I have to put it to achieve the wanted results. thanks
    – john
    Commented May 26, 2011 at 23:10
  • 1
    Add this to your node template $content['comments']['comment_form']['#action'] = ''; or add this to your module mymodule_form_comment_form_alter(&$form, &$form_state) { $form['#action'] = ""; }
    – Blissful
    Commented Aug 24, 2015 at 8:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.