When using Contact Form Blocks, what is the simple way to redirect users to a set page after they have have sent a message. Contact Redirect works for the normal contact form, but not for the contact form in block format. http://drupal.org/project/contact_redirect

Comments

fuerst’s picture

Looks like the Custom (Form) destination module can help you by redirecting the user after submitting one of the forms generated by Contact Form Blocks.

OneTwoTait’s picture

Status: Active » Closed (fixed)

It worked! Thanks. :)

Anonymous’s picture

Status: Closed (fixed) » Active

How can i do the same with Drupal Form API?

$form['#redirect'] = array('home.html', 'mail=send');

This code does not work. Don't wanna install a whole new module just for a simple functionality.

fuerst’s picture

Status: Active » Closed (fixed)

May be another module is resetting the $form['#redirect'] value. Also make sure you modify the correct form - $form_id of any contact form block can be checked by code like this:

  if (preg_match('@^contact_mail_page_\d+@', $form_id)) {
    $form['#redirect'] = array('home.html', 'mail=send');
  }  

Alternatively you may use $form['#submit'][] = 'your_redirect_callback'; in hook_form_alter(). your_redirect_callback() may set the $form_state['redirect'] value. That's how the contact_redirect module is doing the redirect.