I'm using drupal's form API as part of a block in my module.

When the form is submitted, I want to change the content of the block to something else, let's say "Thanks". I do not want the page to redirect, as is default behaviour.

(Admittedly the default behaviour has the benefit of removing the POSTed page from the browser History, so you don't get questioned on hitting Back.)

If not clear, please let me know and I'll post a code sample.

2 Answers 2


Set $form_state['redirect'] = false in the submit handler.


For Drupal 8 use this instead: $form_state->disableRedirect();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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