Form redirect in hook alter submit is not working in Drupal 8 I want to create multi step form based on tabs created using Fieldgroups. I have been able to alter the ECK form as well as added my own custom submit handler.  

In the custom submit handler, I have added a form redirect that redirects to the same form but with a fragment so that the next tab gets shown. I am able to generate the fragment for the route, but its not working. In-fact, the redirect seems to not work at all for any valid internal route. Kindly advise.

Please find the form redirect url.

$url = new Drupal\Core\Url('eck.entity.add'
, ['eck_entity_type' =&gt; 'registration_configuration' , 'eck_entity_bundle' =&gt; 'config_2']
, ['fragment' =&gt; 'edit-group-add']);
$form_state-&gt;setRedirectUrl($url);
I was executing setRebuild()! I added another submit button and started doing the steps in my previous submit logic one by one, then it hit me. Form redirection will not happen if your submit is rebuilding the same form :)

$form_state-&gt;setRebuild();