how to duplicate a form action programatically
In your submit handler:

$form_state-&gt;setRedirect($route_name, $parameters, $options);


Or if you have a URL object:

$form_state-&gt;setRedirectUrl($url);


Reference:


FormState::setRedirect
FormState::setRedirectUrl