The Phone number field in Everest Forms Pro allows user to add their contact phone numbers in the contact form. You can enhance user experience with smart validation, country restrictions, and input customization.
To configure, go to the Field Options by clicking on the Phone Field. You can change the Label, Meta Key, and Description for the field from here. Also, you can see two formats for the phone number field: Default and Smart.
Default Format with Custom Input Mask #
When you select the Format as Default, you can see the Input Mask option, where you can enter a custom input mask.

This option is best for fixed formats (e.g., US phone numbers) as you can manually define the pattern.
Example: Phone Number Input Mask #
An input mask like +1 (999) 999-9999
:
- Automatically adds the
+1
country code and formats the number with parentheses and hyphens. - Restricts input to numbers only (the
9
symbol represents numeric digits).
Here's a detailed guide on using custom input mask.
Smart Format with Country Flag & Validation #
When you select the Format as Smart, it displays the country flag with validation in the dropdown so that users can select their country. Hence, it automatically validates the phone number based on the selected country.

The Smart format dynamically adjusts to the user’s selected country, improving accuracy and usability. Save or Update the form to preview the form for phone field configuration.

Limit Country Options in the Phone Number Field (New) #
By default, the Phone Number field in Everest Forms allows users to select a country from a full list of available options. However, if you want to restrict the dropdown to specific countries, use the filter everest_forms_smart_phone_allowed_countries
How to Restrict the Country List? #
To limit the country list in the Phone Number field, add the following code snippet to your functions.php. You can use the Code Snippets plugin for this.
add_filter('everest_forms_smart_phone_allowed_countries', 'everest_forms_smart_phone_allowed_countries');
function everest_forms_smart_phone_allowed_countries( $allowed_country )
{
$allowed_country = array( 'US','CA', 'GB', 'NP');
return $allowed_country;
}
- You can replace ‘US’, ‘CA’, ‘GB’ with the country codes of your choice.
- Users will only see the specified countries in the Phone Number field dropdown.
- If no filter is applied, all countries will be available by default.

You can find a complete list of country codes here or refer to any international dialing code list. Now, the users can use only the allowed countries in their form field, as shown below:

Hence, to limit the list of countries, you can use the above filter.