This tutorial explains the process of creating a petition form. It dynamically populates hidden fields in the form with dynamic data that is used on the Thank You page and in the email notifications, This method is not recommended for use with large datasets such as Federal election data.
This tutorial is based on the form used on the page:
https://invasives.org.au/how-to-help/take-action/keep-kosci-free-from-feral-horses/
Duplicate a landing page
Create a duplicate of an existing landing page to form the basis of your new page.
- Locating the page in the pages section of the Admin and selecting “Duplicate this”.

- On the pages screen, scroll down to the duplicate page and rename the page name and slug with the quick edit feature.

- Leave the page as a draft.
- Once saved, edit the page with Elementor in a new tab in your browser.
Duplicate an existing form
You can create a new form from scratch or duplicate an existing form that matches or is close to your requirements.
- Go to Forms and locate the front-end form you want to duplicate.
- Hover over the form name and click “Duplicate”

- Rename the form by going to settings > settings.
- Make your changes to the Form Title and save the form.
- Click “Edit” on the form menu and check the form field setup to see if it matches your requirements.
- The form in this tutorial uses the Electorate name as a lookup field for the MP contact details

- Four hidden dynamic fields are populated by a second form. This will be covered later in this tutorial.

Creating the dataset form
The dataset form contains the source data that will be dynamically populated in our front-end form.
The form needs to contain fields for the data that we wish to populate.
In this case, we need four text fields:
- Electorate Search – the lookup field on the front-end form
- MP Electorate
- MP Title
- MP Name
- MP Electorate
- MP Email

You can choose to either duplicate an existing form or create it from scratch.
Populating the Dataset Form
The Dataset form entries will be used as a database for the frontend form lookup fields and merge data. To populate this form, create a spreadsheet with the form field titles in columns and your electorate data. The sheet needs to have a column with a unique ID.

Save a CSV version of the sheet by selecting file > download > csv

Importing the entry data
We use a plugin called WP All Import to import the entry data from the spreadsheet into our dataset form.
To import the spreadsheet data:
- In the Admin, go to All Import > New Import.

- Click the “Upload a file” and locate the spreadsheet CSV you previously saved.
- Once it has finished uploading, select “New Items”.
- Select Create New and choose “Gravity Forms Entries”. From the list.
- In “Select Form to import entries into…” select the blank dataset form.

- Click “Continue to Step 2”.
- A preview of the data from your spreadsheet is displayed.

- Click “Continue to Step 3”.
- Drag the spreadsheet field column names into the entry fields.
- Click “Continue to step 4”.
- Drag the unique id column name into the “Unique identifier” field.

- Leave all settings unchanged and click continue.
- A confirmation page is displayed and check that the summary information is correct.
- Click “Confirm and Run Import”.
- The entries will copied across in batches of 20 records at a time.’
- If successful, an Import Complete screen will appear.

- Return to Gravity Forms and open your dataset form and view the entries. All entries should now be populated with your spreadsheet data,

Connecting the front-end form to the dataset
- Open the front-end form and select “Edit”.
- Scroll down and select the hidden form name field.
- in the Advanced tab, give it a unique name in the “Default Value” field.

- Change the content that displays above the lookup field by clicking on the HTML Content field and changing the content in the corresponding field.

- Click on the “Enter your Electorate” field and make sure the “Populate value dynamically” is not selected.

- Click on the “MP Electorate” field and select the “Populate value dynamically” check box.

- Change the “Type” field is “Gravity Forms Entry” and the form is your dataset form.

- In the “Filters” section, click on the first dropdown field and select the lookup field in your dataset (Electorate Search).
- In the second field, select “is”.
- In the third, select the user input field from your front-end form (Enter your electorate).

- In the “Value Templates” field, select “MP Electorate”.
- Repeat this process for the remaining dataset fields. Change the Value Templates” field so it matches the dynamic dataset field.

- Save the form.
Submission notifications
To track the submission in Gravity Forms, it is important that you use a redirect and change the tracking code data to include the form name, the form ID, and the Thank You page you are redirecting to.
This can be done by:
- Clicking the form settings > confirmations

- In the message field, make sure the “Text” is selected and then change form name, form id and redirection URL.

- In the “Auto-Formatting” section, make sure that “Disable auto-formatting” is selected.

- Click “Save Confirmation”.
Email formatting
To format the email that is sent when a petition is submitted, go to the forms settings dropdown and select Notifications.

- Click the Active “Petition notification NSW” and select Edit.
- Ensure the main email fields follow this format and include the following fields and addresses.

- Enter the copy for the email.
- You can add dynamic fields by selecting a section in the copy, clicking on the merge tag button, and selecting the dynamic merge field.

- Repeat this process for all other dynamic text.
- Click the “Update Notification” button.
Embed the form and test
- Open the landing page you created earlier and edit it with Elementor.
- Change the Gravity Form ID in the shortcode with the gravity Form ID of your form.


- Save the page and test the form.
- Make any other changes required.