This tutorial will show you how to use GP Unique ID for Gravity Forms to generate a reference number on one form then setup another form to confirm that the reference number is valid. Let’s get started!
Getting Started
This tutorial requires the following plugins and resources:
- Gravity Forms
- Gravity Perks
- GP Unique ID
- GW_Value_Exists_Validation snippet
- About 10 minutes
Now that you have installed and activated the above plugins and snippet let’s walk through each step?
- Step 1: Build Form A and add the Unique ID Field
- Step 2: Setup a Gravity Form Notification to deliver the reference number
- Step 3: Build Form B and setup the GW_Value_Exists_Validation snippet
Step 1: Build Form A and add the Unique ID Field
There will be two forms. Form A will handle generating the reference number. Form B will query Form A to make sure that the reference number entered is valid.
The only requirement for Form A is that it contains a Unique ID field. With GP Unique ID installed, you will see a new field available in the Form Editor under the “Advanced Fields” group.
Add this field to your form and save the form. The Unique ID field is a hidden field so will not display on the front-end.
Step 2: Setup a Gravity Form Notification to deliver the reference number
Note: The demo provides the reference number in the confirmation. This was for the sake of simplicity. We recommend sending the reference number via email so the user will always have a copy of it. You could also include it in the confirmation.
Next, visit the Form’s Notifications page. Add a new notification. We’ll assume you are collecting the user’s email address via an Email field on the form. You can configure the notification to be sent to this email address via the “Send To” setting.
You can include the generated reference number in the notification by finding the Unique ID field in the merge tag list (appears to the right of the “Message” setting). Clicking this item will insert the merge tag into the message. When the notification is sent, this merge tag will be replaced with the generated unique ID, which, in this case, is acting as a reference number for the submission.
Step 3: Build Form B and setup the GW_Value_Exists_Validation snippet
Now that we have Form A generating the reference number, we can build Form B which will use a Gravity Wiz snippet to require a reference number in order to submit the form.
Build Form B based on your needs but make sure to include a Single Line Text field where the user will enter their reference number. If an invalid reference number is entered, this field will also display an error message indicating the failure.
Go ahead and following the installation instructions on the GW_Value_Exists_Validation. A few tips for configuring this snippet:
target_form_id
should be the ID of Form B where the reference number is required for submissiontarget_field_id
should be the ID of the field on Form B for which the reference number should be entered and validatedsource_form_id
should be the ID of Form A where the reference number is generatedsource_field_id
should be the ID of the Unique ID field on Form A by which the reference number is generated
That’s it!
How’d we do?
If you found this tutorial helpful, let us know. Also, we’d love to hear other ways that you have used GP Unique ID so we can share the knowledge with others. Thanks!