Skip to main content
removed "Drupal" and tags from the title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

drupal 8 form How do I redirect users after they submit redirectiona form?

I'm looking on how toHow do I redirect users after they submit a form submit.? I tried the following code, but it does notdoesn't work, it tells me that. It says the route does notdoesn't exist:.

public  function submitForm(array &$form, FormStateInterface $form_state){
   $url = Url::fromRoute('/mon-profil/obtenir_document'); // == /node/1
   $form_state->setRedirectUrl($url);
}

drupal 8 form submit redirection

I'm looking on how to redirect after a form submit. I tried the following but it does not work, it tells me that the route does not exist:

public  function submitForm(array &$form, FormStateInterface $form_state){
   $url = Url::fromRoute('/mon-profil/obtenir_document'); // == /node/1
   $form_state->setRedirectUrl($url);
}

How do I redirect users after they submit a form?

How do I redirect users after they submit a form? I tried the following code, but it doesn't work. It says the route doesn't exist.

public  function submitForm(array &$form, FormStateInterface $form_state){
   $url = Url::fromRoute('/mon-profil/obtenir_document'); // == /node/1
   $form_state->setRedirectUrl($url);
}
Source Link

drupal 8 form submit redirection

I'm looking on how to redirect after a form submit. I tried the following but it does not work, it tells me that the route does not exist:

public  function submitForm(array &$form, FormStateInterface $form_state){
   $url = Url::fromRoute('/mon-profil/obtenir_document'); // == /node/1
   $form_state->setRedirectUrl($url);
}