Picture a form that automatically fills in field values from a previous entry. For example, a warranty service form that automatically populates the customer’s registered products.
While you can easily populate the current user’s previous purchases using GF Populate Anything, in this tutorial we’re going to show you a different approach: letting the customer look up their previous entry using values they submitted in that entry.
Looking up previous entries can be done with any form, but for the sake of this tutorial we’ll assume you have an order form that includes at least these four fields:
- Order Number
Step 1 – Add Look Up Fields
In order for your customer to be able to look up their entries, you need to give them some fields to search with. I like to use two fields for enhanced security. In order to do any look up they’ll need to provide two pieces of information.
We’ll start by adding an Order Number and Email field field.
Both of these fields will be used to look up the previous orders.
Step 2 – Look Up Other Field Values
We can now set up Populate Anything to populate the rest of the fields in our form. In my case we’re just going to populate Name and Model. The settings are mostly the same for both fields.
The key is using Populate Anything’s filters to only populate the rest of the form if both the Order Number and Email match what was entered in the other form.
With the same filter settings for both fields, set the Name field’s value template to populate the Name field from the order form.
Follow the same pattern for the Model field, map it to Model from the order form.
You’re done. When a user visits the form and inputs their Order Number and Email address, the Name and Model field will automatically populate.
If the Model and Email fields don’t match an existing order, nothing will populate.
Taking It Further
Automatically Generate Order Number
In our example, we’re looking up the initial Order Number from our sales form. We’re using GF Unique ID to automatically generate that number for every order.
For increased security, GF Unique ID could also be used to generate an unguessable confirmation or reference number for order look-ups.
Make Populated Fields Read Only
By default, the populated fields are editable. To prevent users from being able to edit those fields, use GF Read Only.
Require an Existing Value for Submission
To prevent form submission until the user inputs a valid existing value, check out Require an Existing Value for Submission with Gravity Forms. Based on our order look-up scenario, this would be an easy way to prevent submissions if there is no matching order.