Dynamic Geolocation Field
Introduction
The Dynamic Geolocation Field in Gravity Geolocation dynamically populates form fields with geolocation data sourced from the Geocoder Field or Directions Field. This feature ensures Gravity Forms fields are dynamically updated with accurate geolocation data, reducing manual input and enhancing user experience.
Common use cases include:
- Automatically filling address fields after selecting a location.
- Displaying distances and travel times based on calculated routes.
- Using geolocation data in cost calculations, such as delivery fees based on travel distance.
The Dynamic Geolocation Field integrates seamlessly with Gravity Forms' conditional logic and notifications. For example:
- Show or hide fields based on geolocation data (e.g., address fields, distances, or regions).
- Send notifications to specific recipients based on the user's location or calculated distance.
Dynamic Geolocation Field Types
The plugin supports two primary types of dynamic fields for Gravity Forms:
Dynamic Location Field
The Dynamic Location Field automatically populates location data using the Geocoder Field. Supported data includes:
- Place Name: Useful for location-based personalization.
- Street Number and Name: Helpful for detailed address inputs.
- Neighborhood: Useful for targeting users within specific areas.
- City, County, and Region (Name/Code): For broader geographic targeting.
- Latitude and Longitude: Ideal for mapping and spatial analysis.
- Formatted Address: Standardized addresses returned by Google APIs.
- Place ID: Enables integration with external systems or APIs.
Dynamic Directions Field
The Dynamic Directions Field automatically populates route data using the Directions Field. Common data types include:
- Distance text (e.g., "35 miles" or "25 kilometers").
- Distance value (e.g., "35", "25").
- Distance in meters: Ideal for precise measurements and calculations.
- Duration text (e.g., "2 hours 25 minutes").
- Duration in seconds: Useful for backend calculations.
This field can also be used for cost-based workflows in Gravity Forms. For instance, dynamically calculate a delivery fee by populating a Number Field with the distance and multiplying it by a per-mile rate.
Dynamic Geolocation Field Options
The Dynamic Geolocation Field in the Gravity Geolocation plugin for Gravity Forms offers flexible options to dynamically populate data, link to geolocation fields, and control how the data is displayed. These settings streamline complex workflows and enhance geolocation capabilities.
Supported field types include Single Line Text, Checkboxes, Dropdown, Hidden, Numbers, Multiple Choice, Address, and Paragraph Text.
Use Cases and Advanced Options
The Dynamic Geolocation Field in Gravity Forms is highly versatile. Some additional use cases include:
- Using conditional logic to display or hide fields based on geolocation data.
- Sending notifications based on calculated distances or location-based triggers.
- Cost calculation for services like delivery or ridesharing by dynamically populating distances into a Number Field.
These features make Gravity Geolocation an essential tool for creating intelligent, geolocation-powered workflows in Gravity Forms.
How to Use Dynamic Geolocation Fields
Here's a step-by-step guide to setting up a form that dynamically populates a Text Field with a ZIP code:
-
Insert a Geocoder Field: Add the Geocoder Field to your form. This field is essential for processing and syncing geolocation data with other related fields.
-
Add Geolocation Fields: Include fields such as the Address Field or Google Map Field in your form.
Ensure these fields are linked and synced with the Geocoder Field for proper geolocation functionality. -
Include a Text Field for ZIP Code: Add a Single Line Text Field to your form and label it "ZIP Code."
Set this field as a Dynamic Location Field by:- Selecting Dynamic Location Field under Field Usage.
- Linking it to the Geocoder Field.
- Choosing ZIP Code as the Field Value.
-
Test Your Form: Preview the form and try entering an address in the Address Field. Verify that the ZIP Code is automatically filled in the Text Field labeled "ZIP Code."
Note: Ensure all geolocation fields, including the Geocoder Field, are configured and synced correctly to enable dynamic population. Refer to the Geolocation Field Syncing guide for more details.