Quantcast
Channel: Tutorials Archives | Gravity Wiz
Viewing all articles
Browse latest Browse all 122

Better Pre-submission Confirmation

$
0
0

This snippet is available as a plugin with Gravity Perks. Buy Gravity Perks today to get this perk plus 21 other galatic Gravity Forms plugins!

Are you interested in adding a quick pre-submission confirmation page to your forms where users can preview their entered data before it is submitted? Gravity Forms does not provide any way to do this by default; however, with a bit of custom code and a few simple form configuration instructions, you’ll have pre-submission confirmations working like magic!

One of the big things missing from the Simple Pre-submission Confirmation was support for Gravity Form merge tags. With some recent changes to Gravity Forms, supporting this in HTML fields became a lot easier.

  1. The Code
  2. The Form

Let’s dig in!

Step 1: The Code

The following code can be copied and pasted into your theme’s functions.php file.

View this code snippet on GitHub.

This code provides the ability to use Gravity Form merge tags in an HTML field on the final page of your form, allowing users to preview their data before submission. Since you can now use merge tags, there is no need for the old shortcode method from the previous version of this snippet.

Step 2: The Form

With the code in place, it’s time to configure the form. The first thing we’ll need to do is add a page at the end of the form for the pre-submission confirmation. You can do this using the Page Break field type.

Next add an HTML field from the “Standard Fields” section. I renamed my HTML field “Confirmation”. Your page should now look something like this:

Pre-submission Confirmation Page Configuration

Go ahead and select the HTML field for editing. The “Content” setting of this field now supports all merge tags like {Name (First):4}, {Question:5}, and even more advanced merge tags like {all_fields}. How about that!

You can see exactly what this content generates by submitting the demo form here.

The previous version of this snippet allowed you to put content inside a [gform_preview] shortcode and only display that content if a specified value exists. We’ve dropped support for that in favor of using Gravity Forms default conditional shortcode!

Summary

Let me know how this new code works out for you!

The Saved Forms add-on by soulseekah has been updated to work with this snippet. Make sure you get the latest version of the Saved Forms add-on.

Viewing all articles
Browse latest Browse all 122

Trending Articles