Documentation

Locator Button Field

Last modified: February 26, 2025

Introduction

The Locator Button Field in WPForms Geolocation provides users with a convenient way to retrieve their current location directly within a form. This feature integrates seamlessly with the Geocoder Field and other geolocation fields, supporting IP-based fallback options to ensure reliable geolocation functionality. It is ideal for use cases such as delivery forms, event check-ins, or travel applications.

Note: this documentation focuses on the geolocation-specific options provided by the WPForms Geolocation plugin. In addition to these settings, the field includes all standard WPForms options, such as labels, descriptions, conditional logic, and more, which can be configured the same way as any other WPForms field.

Configuring the Locator Button Field

The Locator Button Field provides several settings to ensure accurate and user-friendly geolocation functionality. These include synchronization with geocoder fields, enabling IP-based fallback, and customizing user messages.

Note: By default, the Locator Button Field uses the browser’s Geolocation API feature to retrieve the user’s location. This method requires the user’s permission to access their browser-based location data. If browser geolocation fails or is unavailable, you can enable IP-based geolocation as a fallback.

Locator button field options
Configuration panel showcasing the Locator Button Field options in the plugin settings.

1. Geocoder Field

Choose the Geocoder Field to synchronize with the Locator Button Field. This ensures that the retrieved location data is stored and processed appropriately. This step is essential for enabling geolocation functionality across your form.

Note: Ensure a Geocoder Field has been added to your form. For setup instructions, refer to the Geocoder Field Documentation.


2. IP Address Locator

Configure how the Locator Button Field should use the IP address to detect the user's location.

Note: Ensure the IP address provider is set up in the plugin's settings page under "IP Providers" for this option to work.

  • Disabled: Do not use the IP address for location detection (Default).
  • Default: Use the IP address as the primary method to determine the location.
  • Fallback: Use the IP address only when browser-based geolocation fails.

3. Messages

Customize messages to enhance the user experience when using the Locator Button Field.

Location Found Message

Enter a custom message to display when the user's location is successfully retrieved (Example: Location successfully detected!).

Note: Leave blank to disable this message.

Hide Location Failed Message

Suppress the alert message displayed when location detection fails. The error details will be logged in the developer console.


Setting Up and Using the Locator Button Field

Follow these steps to configure and use the Locator Button Field effectively:

  1. Add the Locator Button Field: Insert it into your form using the WPForms builder.
  2. Sync with a Geocoder Field: Select the appropriate Geocoder Field to link with this field, allowing synchronization with other geolocation fields.
  3. Set Up Field Options: Configure the Locator Button Field as detailed in the Configuring the Locator Button Field section above.
  4. Test Your Configuration: Preview the form to ensure the Locator Button Field functions as intended.
menu-circle