2

I'd like to do something pretty straightforward: After user fills out a webform, I'd like a button that simply redirects them to a URL (in this case it's to a demo sandbox). Of course I'd want the user to fill in their info to capture for lead-generation purposes. My Webform is set up correctly in that it correctly captures all the user fields and submits them to me via email. However, upon completion "click" I'd like to have the user redirected to a determined internal URL www.mysite.com/foo

I can't figure out how this is done with the vanilla webform settings. Am I missing something obvious?

8

If i had to redirect the users after submission than i would go to the already created webfrom, click on

  • Webform(on top of the form)->Form settings

enter image description here

After scrolling down a bit you will see Redirection location

Choose Custom URL and enter your Internal URL www.mysite.com/foo

enter image description here

Thats it you are done.

2

You don't need code for this.

Install this modules:

Now add a rule that redirects the user to your URL after a webform submission.

1

Edit your webform and go to Form Settings. In Redirection location select Custom URL. That's all.

I usually use the rule method that BetaRide suggested. If you are using any rule logic with your webform go with that solution.

0
0

You can try native idea drupal_redirect_form

Redirects the user to a URL after a form has been processed.

$form_state['redirect'] = 'node';

Or to redirect to 'node/123?foo=bar#baz':

$form_state['redirect'] = array(
  'node/123',
  array(
    'query' => array(
      'foo' => 'bar',
    ),
    'fragment' => 'baz',
  ),
);

You can use it in hook_form_alter

function hook_form_alter(&$form, &$form_state, $form_id) {
 if($form_id == 'YORWEBFORMID') {
   $form_state['redirect'] = 'node';
 }
}
1
  • Thanks, but where exactly would I key this code into? Am I creating a module to do it?
    – Ramanonos
    May 31 '12 at 18:10

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.