Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By setting the $node->webform['confirmation'] key, you can change where Webform redirects the user after form processing has been completed. Use the code below to change the URL based on your own criteria.
// Redirect to Google when done.
$node->webform['confirmation'] = 'http://google.com';
// Redirect to node 1 (an internal Drupal path).
$node->webform['confirmation'] = 'internal:node/1';
// Redirect to the contents of a hidden field.
$node->webform['confirmation'] = $form_values['submitted_tree']['my_hidden_value'];
Comments
Add this code to?
This was my goal, get to the user edit page post registration because of an upon-join webform survey...
Be advised all that this code belongs in the Webform Advanced Settings > Additional Processing:
/:)
webforms will add &sid=xxx
Very usefull: webforms will add &sid=xxx to the url, so you know the unique submissionID.
I want to change the action
I want to change the action - I don't want it to send a message to an email address. I want it to be processed by a custom php form.
How do you do that?
Web Developer
Music Photographer
The action is easily editable
Actually the email is not sent by default, but the sumitted data are stored in DB as a separate content "webform".
You can set the action in Configuration -> Webform advanced settings -> Additional Processing.
Nothing happen
I try to follow this tutorial, but no redirection to my specific page.
I have the same problem.
I have the same problem. Redirecting to google work perfectly, but when I build the redirect url and assign it to a variable, it doesn't work.
Make sure if it's a local
Make sure if it's a local path you add 'internal:' before the path.
Passing more information using query string
How can I pass more variables. I tried
But the resultent URL becomes
How can we manage that?
using url
Hello
This was giving me the same problem.
Now I have found a work-around - by using a full url, as though it was an external link, it is no longer mashing the question mark etc....
$node->webform['confirmation'] = 'http://www.montrealandottawaconference.ca/site/node/2?parent='.($form_values['submitted_tree']['parent_family_name']);
hope that helps
I tried this...
and other things. Nothing is working for me.
I basically want to create a redirect from a webform (node/661) submission to a poll (node/660).
I tried:
1. internal:node/661 (using Full HTML format)
2.
(using PHP format)
Does anyone know how to create a working redirect in a webform? Step by step instructions please.
URL redirect to second form?
Just wondering if you ever got this working. I'm able to redirect my confirmation URL using the below code in the webform "Additional Processing Field." Note I'm still using Drupal 5.23, I know I need to upgrade, but can't at the moment.
but, I need to send two variables from my webform to populate values on a form on node/1493.
I've tried many many variations, but can't seem to send the variables. I've tried the entire URL (instead of internal:node/) and have looked at a tone of documents (e.g., http://drupal.org/node/323553, http://drupal.org/node/257100, http://drupal.org/handbook/modules/webform/submission-code, etc.)
....
The goal is to create a two step form. The data I need stays in my db via webform. The amount and name variables are passed to a node that contains a form that posts to the payment site (like paypal).
If donation amount = X redirect to?
I've been reading about webforms all morning, and think that it will do what I want...but am unclear about the details.
I have a form that has 5 different donation amounts (paypal) and each one has a specific paypal 'target' url/form. How can I say...if donation=$50-->thisurl if donation=$75.00--that url.
I've inherited this project and don't know much about the paypal piece, but I can see by looking at the code on the page that each amount$ has a separate paypal form associated with it.
Thanks
Mark
conditional redirect
Hi
I bashed my head against the wall on this for two days, and then I updated to the latest version of webform.... now I can redirect.
I wrote the following to handle a conditional situation.....
seems to be working..... something like that may help with your paypal question.
I'll try it
Thanks Kent, I'll give it a try
In your code, what are each
In your code, what are each of the parts supposed to be? I assume ['children_question'] is a specific component and ['children'] is the name of the form yes? If my form is named so that no name appears above the form when embedded as a block on pages, could I put [''] or would that not work? Also, how would this work for radio buttons? Same way?
I only ask because I tried this method in my webform and if I submit a test, no redirect actually occurs.
redirect conditions based on action (ie "delete")
i've managed to get redirect working, but can't figure out how to make it conditional upon the update action - in other words what i want to do is have a specific redirect when the webform is deleted
any ideas if this is possible using the method described here?
Paired with pathauto
In my setup I'm using pathauto and I used the following solution to redirect to the node the user was on before clicking a link to fill out a webform request:
I added a hidden form field called referring_node has a default value of %get[nid]. The link bringing the user to the webform is appended with the query string ?nid=[nid] via php in the node.tpl.php.
As noted in the discussion thread, for some reason the only way to get the redirect to work was to use an absolute path. Using 'inner:'.$form_values['submitted_tree']['return_path'] did not work.
Hope this helps.
Kevin
Personal: @kevinjthull
Foodies: @sharednoms
Food Trucks: @foodtruck50
$node->webform['confirmation'] is no good...
It's taken me a while, but I finally figured out why $node->webform['confirmation'] wasn't working for me. This is probably because I'm using webform-6.x-3.0-beta2, but for the redirect to work for me, I had to use $node->webform['redirect_url']. I hope this helps others...
This probably has something to do with the changes brought about by http://drupal.org/node/520524 , but TLDR....
trying to create custom module for redirect?
So I was so close to implementing this until I updated to the new module and lost the Additional Processing field. I understand this is a security issue and the author suggested using a module. I have manually created a hidden "referring_node" component in my webform and am trying to change redirect_url with a custom module using hook_alter. So far, drupal doesn't even see my module but hopefully I'm in the ballpark. I created a .info file and .module in a webform_redirect folder inside sites/default/modules:
The webform_redirect.info file:
The webform_redirect.module file:
Since I'm using a module, I would like to create something eventually that would create the referring_node component, as well as support for taxonomy pages, and other people could avoid the hassle!
Using query strings
I don't know if this might help someone, but I have had problems passing query strings.
Internal links don't work as per heidihillyard.
So I set the confirmation url to an absolute http:// using something like
url('node/120/', array('query' => 'query=' . $the_query, 'absolute' => TRUE))
but this fails at line 1903 of webform.moduleelseif (valid_url(trim($node->webform['confirmation']), TRUE))
I know this is a hack, but what worked was removing this code.
It's taken me a while, but I
It's taken me a while, but I finally figured out why $node->webform['confirmation'] wasn't working for me. This is probably because I'm using webform-6.x-3.0-beta2, but for the redirect to work for me, I had to use $node->webform['redirect_url']. I hope this helps others...
Thanks lacrosse_20 - that worked!
Redirect to more than one hidden field
Just giving back- spent almost 25 minutes on this and figured i'd save someone else the headache since its not listed.
this will redirect to: http://www.XXX.com?id=XX&PARAM2=XXXXX&PARAM3=XXXX&PARAM4=XXX
could have easily been:
Undefined variable: form_values
I am trying to work with the suggestions provided here to redirect to a different url based on 2 options in my form (course and location). I tried this solution and several others, but am receiving an error that form_values is undefined. I am not that familiar with PHP, so this may be a simple problem.
I have tried this code in my template.php:
This IS redirecting, but not where I would expect. It's going to [BASEURL]/training/course-registration/register/course%3D/location%3D?sid=276 and does not seem to be loading the course value and location value as I would expect. I am not sure where the "?sid=276" part is coming from.
Any help would be very appreciated! Thank you.
No confirmation text after redirect.
Hello.
I use webform as contact form in the bootom of my node page. It's assosiated with the node, and admin get an email that sbdy interests about certain node.
But I want user who submits webform stay on the same page ang get a confirmation ("Thanks!!tra-la-la...").
To stay on the same page I must use redirection to that page BUT in such case I can't show confirmation text.
Please help))
webform 3.x beta and redirect_url
I couldn't for the life of me get the current webform 3.x to redirect by setting redirect_url via the 'additional processing' input with the webform_php module ... I could put print_r($node->webform, true) into a drupal_set_message() and see that it was being set...but webform was not redirecting, so I came up with a bit of a round about solution that works really well.
1) Instead of setting the following:
I set this:
2) I then set the redirect url for the whole webform to a custom page containing the following php body:
This worked really well for me and I haven't had any problems since....of course this is just an example, in reality this would be much too complicated for a single static message and frontpage redirect.
Tried most of these, anything new?
I am quite new with Drupal.
Have been trying to get a dynamic URL to be used for redirect after form submit using a custom module.
As I am still getting nowhere, is there something new on the subject or is the solution above (load values in Session and re-use in a custom page) the only one working?
By the way, the solution above, though clever, means 2 redirects.
thanks
Works with 6.x-3.1...
Add submit handing function after webform's original webform_client_submit().
Example code for module solution:
Simple, easy, and took hell of a time to figure it out ;)
Pozdrawiam,
Radek Pycka
Same here!
I need a conditional redirect and redirect_url doesn't work for me either. I can error_log the output, but the form doesn't go to that page. Very odd.
I'm using Drupal 6, webform-3.2.
Redirect not working
I am trying to get this to work but am having trouble. Here is my code:
When I submit the form, I get a blank page. Any thoughts on what I am doing wrong?
Thanks!
There is a bug s.t. the code
There is a bug s.t. the code featured in this article doesn't work. See http://drupal.org/node/864010
Use drupal_goto()
Thanks, primerdp. The solution is to use drupal_goto() rather than change the value of $node (a change that will not be sent back to the webform module).
I am trying to get this to work but am having trouble...
Check out my post about redirecting using webform 3.x. This worked for me http://drupal.org/node/865326#comment-3773072
Hope it helps!
Redirect to page in lightbox
I'm trying to figure out how to send the user to a thank you page inside a lightbox.
Works great... but I need to some how add the rel="lightframe" into the mix.
Is this possible?
This will open google in my lightbox but how can I open my webform's thank you page in the lightbox?
this code is not working
hi,
i have tried this code but it is not working... here is my code...
$version6 = $_POST['submitted']['light_blue']['version'];
if($version6 ==t( '12'))
{
$node->webform['confirmation'] = 'http://www.google.com';
//$node->webform['confirmation'] = 'internal:node/30';
}
but still unable to redirect to any of the page. please advise. where i m doing wrong...thanks in advance
one more thing which redirection item should i select to work it properly.
confirmation page or no-redirect??
Form hook_form_alter
For those of you interested in using this from hook_form_alter (perhaps you are modifying a webform dynamically like me) changing the redirect is as easy as this:
Where can I write this code?
Where can I write this code? Is there any hook or ....?
// Redirect to Google when done.
$node->webform['confirmation'] = 'http://google.com';
// Redirect to node 1 (an internal Drupal path).
$node->webform['confirmation'] = 'internal:node/1';
// Redirect to the contents of a hidden field.
$node->webform['confirmation'] = $form_values['submitted_tree']['my_hidden_value'];