How to perform a redirect based on the value entered in a Webform component? How to perform a redirect after a Webform submission, i.e. to different pages for different answers?

The scenario is like so:


If user enters "foo" for some Webform component, then page must be redirected to /foo.
If user enters "anything else but foo", then page must be redirected to /bar.
You can achieve by altering the Webform.


function hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'YOURFORMID') {
    $form['#submit'][] = 'ctm_redirect';
  }
}

function ctm_redirect(&$form, &$form_state) {
  if (CONDITIONS) {
    $form_state['redirect'] = 'foo';
   }
   else{
     $form_state['redirect'] = 'bar';
   }
}


You can also check Webform Rules module.

This module adds rules integration on webforms.


  Did you ever want to react on webform submission using rules but
  couldn't find the proper event? Webform Rules makes it possible to
  catch webform submissions by rules and do whatever you'd like to do
  with it (meaning: do whatever rules let you do with it).