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.

7

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

| improve this answer | |
  • I would appreciate if you could write what code exactly and where I have to put this. – john May 26 '11 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 May 26 '11 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'] = ""; } – Marko Blazekovic Aug 24 '15 at 8:20

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