Form Tools
Multiple Thank you Pages - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8)
+--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18)
+--- Thread: Multiple Thank you Pages (/showthread.php?tid=1442)



Multiple Thank you Pages - fraserkelly - Jul 8th, 2011

First of all, apologies if this issue has been tackled elsewhere on the forum but I couldn't find it.

Please bear with me as I attempt to explain my problem...

My website has a pretty basic contact form that requires the following function to be performed.

Depending on what options are selected I need the visitor to be sent to one of 3 thank you pages. The reason for this is that a tracking code will be placed on the thank you page for a specific service.

Hopefully there is a module that can tackle this but if not I'd be grateful if you could help me tackle this problem please. I'm a novice at this unfortunately so you'll have to bear with me!

Hopefully that explains my problem enough but any questions please let me know.


RE: Multiple Thank you Pages - Ben - Jul 8th, 2011

Hey fraserkelly,

Sure, no problem! There's a couple of different solutions.

Does your form require javascript? If it does, a JS approach is probably the simplest.

So here's the thing: although you define a "Redirect URL" value in the Form Tools interface for the form, you can actually override it for any individual form by passing along a hidden field like so:

Code:
<input type="hidden" name="form_tools_redirect_url" value="http://mysite.com/otherpage.php" />

So one solution is just just add some JS to your form that when the form is submitted, sets the appropriate URL in the field.

But if you want your form to work without javascript as well, you'll need to do it server-side. For this, you'll need the Submission Pre-Parser module:
http://modules.formtools.org/submission_pre_parser/

Let me know if you're interested in this method and I'll explain how to do it.

All the best!

- Ben


RE: Multiple Thank you Pages - fraserkelly - Jul 8th, 2011

(Jul 8th, 2011, 4:04 PM)Ben Wrote: Hey fraserkelly,

Sure, no problem! There's a couple of different solutions.

Does your form require javascript? If it does, a JS approach is probably the simplest.

So here's the thing: although you define a "Redirect URL" value in the Form Tools interface for the form, you can actually override it for any individual form by passing along a hidden field like so:

Code:
<input type="hidden" name="form_tools_redirect_url" value="http://mysite.com/otherpage.php" />

So one solution is just just add some JS to your form that when the form is submitted, sets the appropriate URL in the field.

But if you want your form to work without javascript as well, you'll need to do it server-side. For this, you'll need the Submission Pre-Parser module:
http://modules.formtools.org/submission_pre_parser/

Let me know if you're interested in this method and I'll explain how to do it.

All the best!

- Ben


Thanks Ben. Appreciate your help. Could you please explain the pre parser solution. Hopefully this will be easier!

Thanks
Thanks Ben,
.
Your help is appreciated.
Could you please explain the pre parser solution? Hopefully this might be a little easier.

Thanks again,
Fraser
Thanks Ben,
.
Your help is appreciated.
Could you please explain the pre parser solution? Hopefully this might be a little easier.

Thanks again,
Fraser


RE: Multiple Thank you Pages - Ben - Jul 29th, 2011

Hi Fraser,

Sorry I totally missed your response.

Sure! Here's how it would work. First, just download and install the Submission Pre-Parser module:
http://modules.formtools.org/submission_pre_parser/

Then, inside the module, create a new rule that's assigned to your form. Make sure it's set to be triggered "on submission" (i.e. when the submission is first submitted).

Lastly, in the PHP aread

PHP Code:
if ($_POST["something"] == "value 1") {
  
$_POST["form_tools_redirect_url"] = "http://www.site1.com";
} else if (
$_POST["something"] == "value 2") {
  
$_POST["form_tools_redirect_url"] = "http://www.site2.com";
} else if (
$_POST["something"] == "value 3") {
  
$_POST["form_tools_redirect_url"] = "http://www.site3.com";


What that code does is look for a form field with a name attribute of "something", then if it has a particular value (value 1, value 2 or value 3), set the redirect URL to something different.

You'll need to change those values to whatever makes sense, but that's the idea!

- Ben


RE: Multiple Thank you Pages - Pauletteaters - Sep 19th, 2021

In this blog post, I will discuss the importance of a thank you page in a marketing campaign. A thank you page is an important part of any marketing campaign because it increases brand awareness and encourages customers to purchase from your dissertation service uk. This is why it's so important to have a well-designed thank you page that engages with the customer and makes them feel appreciated.