Submit handler in hook_form_alter not working in d8 I have hook_form_alter as follows :

function auto_ga_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    global $base_url;     
    if($form_id == 'node_p_request_form' || $form_id == 'node_p_request_edit_form' || $form_id == 'node_f_pro_request_form' ) { 
      $form['#submit'][] = 'custom_form_submit_fn';
      $form['actions']['submit']['#submit'][] = 'custom_form_submit_fn';
   }
}


function custom_form_submit_fn(&amp;$form, $form_state) { 
  echo 'reached in submit handler';exit;
}


But its not going to the submit handler . both usage ( $form['#submit'][] OR  $form['actions']['submit']['#submit'][]) of submit handlers not working 

And idea ??
What you are doing looks like it should work.

Doing an echo is undetecable in the submit handler, since Drupal will do a redirect after the POST request and thus clearing all of the output generated but Drupal in the actual submit handler.

A simple way to test if the submit handler is called or not is to insert a die()

Reasons for submit handler not being called could be:


You submit the form with a button you haven't added a submit handler on and that already have one or more attached to it.
Another alter hook removes your submit handler (unlikely)