This page may contain affiliate links. Please read my disclaimer for more information.

Display Text Confirmation Before Redirecting in Gravity Forms

  |  by Chris Eggleston

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 to 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.

Photo of author
About the Author
Chris Eggleston
I’m not just a Gravity Forms enthusiast; I’m a dedicated father and loving husband. As the owner of WP Mantis & Marketing Draft, I’m on a mission to simplify the WordPress experience for site owners. I try to bring a unique perspective to the Gravity Forms community.
Gravity Wiz Add-Ons

Advertisement

0 0 votes
Article Rating
Subscribe
Notify of
guest
17 Comments
Inline Feedbacks
View all comments
Bryan
Bryan
1 year ago

Does Option 2 still work? Getting an error message…

Bryan
Bryan
Reply to  Chris Eggleston
1 year ago

Thank you

Bryan
Bryan
Reply to  Chris Eggleston
1 year ago

All right. Thank you. Unfortunately, since I am not the SuperAdmin, I don’t have the capability of adding a plugin, but I can discuss it with him and see what he want to do.

Bryan
Bryan
Reply to  Chris Eggleston
1 year ago

I do believe so. Are you seeing it working if auto-formatting is disabled?

Bryan
Bryan
Reply to  Chris Eggleston
1 year ago

Very good. I will test it out.

Bryan
Bryan
Reply to  Bryan
1 year ago

Hmmm…

Bryan
Bryan
Reply to  Bryan
1 year ago
Bryan
Bryan
Reply to  Chris Eggleston
1 year ago

PHP 8.0.28
Gravity Forms 2.7.12

Bryan
Bryan
Reply to  Bryan
1 year ago

Figured out the issue. Script works fine. Because I am not the SuperAdmin, however, Gravity Forms would not permit me to include Javascript in the confirmation. My SuperAdmin was able to do it for me, however. Thanks for all your help with this.

Charlie
2 years 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
2 years 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.