How to Show Country Codes and Flags in Gravity Forms Phone Fields

Turn your basic phone field into a smart country selector that gets perfectly formatted numbers, every time.

  1. How Does the Country Code Selector Work?
    1. Quick Country Code Detection
  2. How to Customize the Country Drop Down
    1. Pick Default Starting Points
    2. Pick Your Common Countries
    3. Limit Countries

Collecting phone numbers from a global audience can go sideways fast: wrong formats, missing country codes, total chaos. The fix? GP Advanced Phone Field.

Let’s get this sorcery working for you.

This article requires the Gravity Forms Advanced Phone Field perk.

Buy Gravity Perks to get this perk plus 50 other premium Gravity Forms plugins!

View Plugin Buy Now

How Does the Country Code Selector Work?

The moment you enable Advanced Phone Field, a sleek country drop down appears at the start of your phone field, complete with a flag for every country. Users can then click, scroll to their country, and select. Simple!

If it’s your first time using Advanced Phone Field, we have a guide that teaches you how to easily set it up.

Quick Country Code Detection

Advanced Phone Field is also smart enough to recognize a country code as it’s being typed. For example, if someone enters +370, it will instantly display the correct flag for Lithuania.

A user enters the country code for Lithuania '+370' in the phone field.

Tip

Want to make sure all phone numbers entering your database are legit? Check out our article on how validation works on Advanced Phone Fields.

How to Customize the Country Drop Down

Let’s take it a step further by controlling which countries show up in the drop down.

Just head to FormsSettingsAdv Phone Field.

Take Note: These global settings affect all your Advanced Phone Fields across every form.

Pick Default Starting Points

Advanced Phone Field auto-detects a user’s country by checking their IP address location (using IPinfo). If you want to choose a different starting country, just set a Default Country from the list.

The Default Country dropdown menu is selected, with Canada highlighted in the list of available options.

Pick Your Common Countries

The Preferred Countries setting pins your most common countries to the top so users don’t have to search for them.

For example, if we pin the UK and US at the top:

A user selects the country drop down field, and hovers over the United States and United Kingdom from the list.

Limit Countries

When you need to limit which countries appear in the drop down, there are two ways:

  • Only Include: Build a curated list where only chosen countries make the cut.
  • Exclude: Start with everyone and remove undesired countries from the drop down.

Tip

Need all countries to appear on a specific form? Use our Show All Countries snippet to overried your globale rules just for that form.

Time to get global with those phone numbers. 🌎

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.


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.