Documentation

WPForms Dynamic Geolocation Field

Last modified: March 2, 2025

Introduction

The WPForms Dynamic Geolocation Field in WPForms Geolocationdynamically populates form fields with geolocation data retrieved from the Geocoder Field or Directions Field. This feature enhances user experience by automating field inputs with accurate geolocation data, minimizing manual entry.

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 calculations, such as delivery fees based on travel distance.

The Dynamic Geolocation Field integrates seamlessly with WPForms' conditional logic and notification features. For instance:

  • Show or hide fields based on geolocation data (e.g., distances or regions).
  • Send notifications to specific recipients based on user location or calculated distances.

Dynamic Geolocation Field Types

WPForms Geolocation supports two primary types of dynamic fields:

WPForms Dynamic Location Field

WPForms Dynamic Geolocation Field - Dynamic Location Field options
Dynamic Location Field options for populating geolocation data in WPForms.

The Dynamic Location Field automatically populates location-related data from a Geocoder Field. Available data includes:

  • Place Name
  • Street Number
  • Street Name
  • Street (Street Number + Street Name)
  • Street (Street Name + Street Number)
  • Premise (e.g., Apartment/Suite Number)
  • Subpremise
  • Neighborhood
  • City
  • County
  • Region Name (e.g., State/Province Name)
  • Region Code (e.g., State/Province Code)
  • Postcode (Zip Code/Postal Code)
  • Country Name
  • Country Code
  • Address (As entered by the user)
  • Formatted Address (As returned by the Google API)
  • Latitude
  • Longitude
  • Coordinates (Comma Separated)
  • Coordinates (Serialized)
  • Address + Coordinates (Serialized)
  • Place ID

WPForms Dynamic Directions Field

Dynamic Directions Field configuration in WPForms
Options for configuring the Dynamic Directions Field in WPForms.

The Dynamic Directions Field automatically populates route-related data from the Directions Field. Data types include:

  • Distance text (e.g., "35 miles" or "25 kilometers").
  • Distance value (e.g., "35", "25").
  • Distance in meters: For precise measurements.
  • Duration text (e.g., "2 hours 25 minutes").
  • Duration in seconds: Useful for calculations.

This field can also streamline workflows by dynamically populating distances into Number Fields and using WPForms' calculation features for cost-based operations.

WPForms Dynamic Geolocation Field Options

The Dynamic Geolocation Field offers flexible configuration options to populate geolocation data dynamically. Supported field types include Single Line Text, Checkboxes, Dropdown, Hidden, Numbers, Multiple Choice, Address, and Paragraph Text.

WPForms Dynamic Geolocation Field - Geocoder Field setup
Configuration options for Dynamic Geolocation Field in WPForms.

1. Dynamic Field Usage

Choose the type of data to populate dynamically:

  • Dynamic Location Field: For location data like address components.
  • Dynamic Directions Field: For routing data like distances and durations.

2. Linked Geolocation Fields

Define the Geocoder or Directions Field to act as the data source:

  • Geocoder Field: For location data.
  • Directions Field: For routing data.

3. Field Value

Select the specific data to populate based on the field type:

  • Location Fields: Includes options for street, city, coordinates, etc.
  • Directions Fields: Includes options for distance and duration.

Note: Available options vary by field type. For cost calculations, populate a Number Field with distance and use WPForms' calculation features for dynamic pricing.

Use Cases and Advanced Options

The Dynamic Geolocation Field in WPForms Geolocation offers versatile applications, including:

  • Conditional logic based on geolocation data.
  • Notifications triggered by user location or distances.
  • Cost calculations for services like deliveries or ridesharing.

How to Use Dynamic Geolocation Fields

Follow these steps to configure a form that populates a Text Field with a ZIP code dynamically:

  1. Add a Geocoder Field: Insert the Geocoder Field into your form. This field is required to process and sync geolocation data with other geolocation fields.

  2. Add Geolocation Fields: Include geolocation fields such as the Address Field or Map Field into your form. Sync these fields with the Geocoder Field to enable geolocation data processing and synchronization.

  3. Add a Text Field for ZIP Code: Add a Single Line Text Field to your form and label it "ZIP Code." Configure it as a Dynamic Location Field by:

    • Setting the Field Usage to Dynamic Location Field.
    • Linking it to the Geocoder Field.
    • Choosing ZIP Code as the Field Value.
  4. Test the Form: Preview the form and test it by entering an address in the Address Field. Ensure that the ZIP Code is automatically populated in the Text Field labeled "ZIP Code."

Note: Make sure all geolocation fields, including the Geocoder Field, are properly configured and synced for the dynamic population to work. For more details, see Geolocation Field Syncing.

menu-circle