3

I have tried to redirect after submitting.

public function submitForm(array &$form, FormStateInterface $form_state) {
   $form_state->setRedirect('mymodule');
   $form_state->setRedirectUrl(\Drupal\Core\Url);
}

I get the following error.

Fatal error: Undefined constant 'Drupal\Core\Url'

Can anyone help me with the redirection?

1
  • I have added below code in my Submit form function at it worked. $form_state->setRedirect('route'); return; Jan 18, 2017 at 5:25

0

Browse other questions tagged or ask your own question.