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
You can do this, by using hook_form_alter
and then change the $form['#action']
value to point to the current destination.
-
I would appreciate if you could write what code exactly and where I have to put this.– johnCommented May 26, 2011 at 23:10
-
1I would appreciate if you write what code exactly and where I have to put it to achieve the wanted results. thanks– johnCommented May 26, 2011 at 23:10
-
1Add 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'] = ""; }– BlissfulCommented Aug 24, 2015 at 8:20