0

I want to change the form action on form build. I have tried with form_alter with #action = '/page'; but its not working.

1

There are several triggers that can prevent $form['#action'] from working in an alter hook. See:

How to redirect to a page after submitting a form

For example, there is a no_redirect property:

FormState::$no_redirect

"If set to TRUE the form will NOT perform a redirect, even if self::$redirect is set."

You can test this with

$form_state->isRedirectDisabled()
  • I have added a little more info, but, without more code, it's hard to know what's causing the issue. – oknate Dec 14 '16 at 20:15
  • Much better, merci! BTW, about "hard to know": I don't think there is anything wrong in making assumptions in answers to question. Instead of just closing a question as unclear or something similar, which is much easier to do, as compared to trying to make the OPer think about what the question is really about. – Pierre.Vriens Dec 14 '16 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.