Display Text Confirmation Before Redirecting in Gravity Forms

THIS POST MAY CONTAIN AFFILIATE LINKS. PLEASE READ OUR DISCLAIMER FOR MORE INFO.

Symptoms

Out-of-the-box Gravity Forms does not support using two confirmations at the same time when a form is submitted.

However, because we were recently asked how to show a confirmation message before redirecting the user to another URL, we decided to put together a couple of options.

How To Fix It

There are (at least) three different ways of accomplishing this.

  1. You can use the gform_confirmation filter to output a confirmation message and then perform a redirect (code snippet below).
  2. Add custom JavaScript to the text confirmation (code snippet below).
  3. Use a third-party redirect plugin.

1. The gform_confirmation filter:

Copy and paste the code snippet below into your themes functions.php file or use a functionality plugin like WPCodeBox (recommended).

Once the code is added you will need to make three modifications:

  1. On line 31 add your form ID number(s), replacing 5, 16, 43 with your form ID(s).
  2. Edit the confirmation message on line 40, change it to whatever you’d like, or leave it as is.
  3. On line 42 set the number of seconds you’d like to delay the redirect. The snippet is currently configured for a two second delay, 2000 = 2 seconds.

Configure the Redirect Confirmation

For this snippet to work, your form’s default confirmation must be set to redirect and configured with the desired URL.

  1. Go to the form Settings
  2. Click Confirmations
  3. Click to edit the Default Confirmation
  4. Click Redirect
  5. Enter your URL
  6. Click Save Confirmation

2. Custom JavaScript text confirmation

This option requires that the default confirmation be configured to use the Text type and the snippet below be added into the editor text tab.

  1. Go to the form Settings
  2. Click Confirmations
  3. Edit the Default Confirmation
  4. Make sure Text is selected
  5. Click on the Text tab
  1. Copy and Paste the snippet below into the editor
  2. Make any changes you’d like to the message
  3. Set your desired number of seconds to delay the redirect (i.e 2000 = 2 seconds)
  4. Check to Disable auto-formatting
  5. Click Save Confirmation

Redirect plugin

You will need to install the Shortcode Redirect plugin. This is essentially the same solution as using the custom JS above, it is just a code-free method if you prefer to avoid messing with code.

  1. Go to the form Settings
  2. Click Confirmations
  3. Edit the Default Confirmation
  4. Make sure Text is selected
  5. Create your message
  6. Add the plugin shortcode to the message (below)
[redirect url='https://yoururl.com' sec='2']
  1. Add your redirect URL to the shortcode
  2. Set the number of seconds you want to delay the redirect
  3. Click Save Confirmation

Need More Help?

If you still need help, feel free to use the comments or chat options below.

If you have an active Gravity Forms license, you can also open a support ticket here.

0 0 votes
Article Rating
Subscribe
Notify of
guest

3 Comments
Inline Feedbacks
View all comments
Charlie
8 months ago

This is great guys. Quick question concerning the first solution…does it still work with multiple redirect confirmations setup to trigger on specific pages?

Hugatron
Hugatron
1 year ago

Thank you! After much searching, this is the first where I got clear instructions on how to accomplish. With other sites (including gravity forms) I had no idea where to place the code.

I didn’t even think about adding js to the confirmation directly, using the ‘text’ tab.