Gravity Forms Advanced Phone Field

Level up your Phone fields with automatic country code selection, real number validation, and stylish visuals.

What does it do?

Gravity Forms Advanced Phone Field enhances the Phone field in Gravity Forms with automatic phone number validation and an interactive drop down for selecting country codes. Additionally, it parses a variety of meta data about the phone number which can be used in conditional logic or to filter entries.

Features

  • Phone number validation.
    Ensure submitted phone numbers are real numbers. No more throwaway numbers. Less typos.
  • Selectable country codes with flags.
    Customers can easily select their country code and will appreciate country flags as a visual aid.
  • Auto-detect default country.
    Automatically detect the country code by visitor location or set a default country.
  • Filtered and preferred countries.
    Filter which countries are available for selection and place preferred countries at top of selectable list.
  • Capture phone meta.
    Capture phone type, location, carrier, and more.
  • Use Phone meta in conditional logic.
    Trigger conditional logic based on captured metadata.
  • Automatic updates.
    Get updates and the latest features right in your dashboard.
  • Legendary support.
    We’re here to help! And we mean it.

How do I enable this functionality?

Add a Phone field to your form.
Open the field’s settings, navigate to the Perks section, and check _Enable Advanced Phone Field_.

Feature Details

Gravity Forms Phone Number Validation

Any phone number entered into a Phone field that has GF Advanced Phone Field activated is validated on submission. Not only does it check for proper number formatting on a per-country basis, the number is also validated to ensure that it is a real number. If an invalid phone number is entered, the form will fail validation on submission and the field will display a message asking the user to enter a value phone number.

Selectable Country Codes with Flags

Advanced Phone Field simplifies user entry of phone numbers by inserting a country code drop down with integrated flags at the beginning of the field. Users can click on this drop down to select their country.

If a user types in their country code into the field, for example +506 for Costa Rica, Advanced Phone Field will automatically switch the flag and country in the drop down.

Settings

Advanced Phone Field’s settings are found in Forms > Settings > Adv Phone Field. Changes made here will affect all instances of Advanced Phone Field across all forms.

Default Country

By default, Advanced Phone Field will determine the user’s country by GeoIP location. If you’d prefer to set a default country instead, you can select the default country here.

Preferred Countries

The country code selector’s default behavior is to list all countries in alphabetical order. Use this setting to choose preferred countries and display those countries at the top of the list.

Limit Countries

All countries are included by default, but you can choose to limit the available countries. There are two ways to handle this.

  1. Select Only include the following countries… to build a list of included countries. Any countries you select will be the only countries available.
  2. Select Exclude the following countries… to allow all countries except for an excluded few. Any countries you select will be excluded from the list.

Phone Meta

Advanced Phone Field captures phone meta when the form is submitted. This is stored along with the entry and can be used in a variety of ways.

  • Country Code
    Dialer code
    Ex: 1
  • Type
    Fixed line or mobile
    Ex: MOBILE
  • National Number
    The number dialed within the country
    Ex: 7574279189
  • National Number Formatted
    The number dialed within the country styled in the country’s standard format.
    Ex: (757) 427-9189
  • Region Code
    The 2-letter country code.
    Ex: US
  • Raw
    Full number without formatting
    Ex: +17574279189
  • Description
    Geographic location
    Ex: Virginia Beach, VA
  • Carrier
    Company that services the number
    Ex: VERIZON
How to Display Phone Meta in the Entry List Page

To display phone meta in the Entry List Page, click the gear icon to edit the Entry Columns. Then, select the phone meta fields you want to display.

Any selected phone meta fields will display the captured data. Do note that not all data is available for all numbers.

Using Phone Meta in Conditional Logic

Phone meta can be used in conditional logic for Notifications. After enabling conditional logic for a notification, each of the phone meta fields are available from the drop down.

Phone Meta Merge Tag Modifiers

Advanced Phone Field introduces additional merge tag modifiers so you can include phone meta information in Confirmations, Notifications, or anywhere else merge tags are supported.

  • {Phone:1:phone[type]}
  • {Phone:1:phone[countryCode]}
  • {Phone:1:phone[nationalNumber]}
  • {Phone:1:phone[nationalNumberFormatted]}
  • {Phone:1:phone[regionCode]}
  • {Phone:1:phone[raw]}
  • {Phone:1:phone[description]}
  • {Phone:1:phone[carrier]}

To use the modifiers, simply add :phone[meta_key] to your Phone field’s merge tag. For example, if my Phone field’s ID is 1 and I want to output the country code, I would use {Phone:1:phone[countryCode]}.


Known Limitations

  • Carrier and Type phone meta cannot always be reliably determined, particularly in the United States. Do not rely on these meta values being present.
  • There is a discrepancy between the default padding that separates the flag selector and the phone number input. Unfortunately, the padding is hardcoded in the 3rd-party library that powers GPAPF.
    • Solution: This snippet will automatically adjust the padding to match the inputs default padding. This solution may not work if the input’s padding is not set in `px`.
  • Advanced Phone Fields uses IPinfo to auto-detect the user’s country based on their IP address. By default, this auto-detection is limited to 50,000 lookups per month. Each user’s IP location is cached in local storage and is only looked up once per 24 hours.

Translations

You can use the free Loco Translate plugin to create translations for any of our Perks. If you’ve never used Loco translate before, here’s a tutorial written for beginners.

Developer’s Notes

Advanced Phone Field’s frontend is powered by the International Telephone Input JS Plugin.

When a form entry gets submitted, the number validation and meta data capture process is powered by Google’s libphonenumber library.

FAQs

What are “real” phone numbers?

A real phone number is a phone number that will pass validation with libphonenumber (Google’s library in Android since 4.0 for validating phone numbers). While a number may pass validation, it could be disconnected.

Gravity Forms Phone Number Verification

For a full verification that the number exists and belongs to the user filling out the form, we recommend sending a confirmation text or call with Twilio.

Hooks

Gravity Forms has hundreds of hooks. Check out our Gravity Forms Hook Reference for the most thorough guide to Gravity Forms’ many actions and filters.


No related resources found.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.