short question. I'm using node registration module. Can i use hook_form_alter to redirect to some custom page after form submit?

  • Please outline the things you have tried already and post some code. Sep 10 '15 at 11:47

To redirect user to a particular page after the form is submitted you can use $form_state['redirect']


//Implementation of hook_form_alter()
function mymodule_form_alter(&$form, &$form_state, $form_id)
    switch($form_id) {
        case 'form_id_of_the_form_to_alter':
            $form['#submit'][] = 'custommade_custom_submit';
//Custom submit handler
function custommade_custom_submit($form, &$form_state) {
    $form_state['rebuild'] = TRUE;
    $form_state['redirect'] = 'whatever/link/to/redirect';

Hope this helps.

  • Ok, I'll check this out later and will let You know if it works. Thanks
    – user51851
    Sep 10 '15 at 12:08

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.