UPDATED: 18.08.2025 • If you’re building forms with JetFormBuilder, you’ve probably noticed that the default phone field is pretty basic. Today, I’ll show you how to enhance it with a country flag, automatic dial code, and smart country detection—all without needing a geolocation API key.
Why enhance the JetFormBuilder phone field?
The standard JetFormBuilder Phone field accepts any input, which often leads to invalid or messy numbers. By adding flags and dial codes, you:
- Make forms more user-friendly and intuitive
- Reduce typing errors on mobile
- Automatically normalize numbers for CRM or WooCommerce integration
- Improve lead quality with consistent E.164 formatting
Features you’ll get
- Flag + dial code UI powered by intl-tel-input
- Smart country auto-detection without extra API calls (uses saved value → time zone → browser language → fallback US)
- Clean submission: numbers stored in
+CCXXXXXXXX format
- Works with any JetFormBuilder form out of the box
- Lightweight and CDN-optimized
What you need before starting
To use this method, you’ll need:
How to set it up with a snippet plugin
The process is straightforward:
- Install and activate your preferred snippet plugin.
- Create a new PHP snippet.
- Paste the provided code and enable it everywhere on the front-end.
- Publish a JetFormBuilder form with a phone field and see the new flag + dial code in action.
How auto-detection works
Instead of relying on a paid API (like Google Maps or IPinfo), the snippet uses a smart detection order:
- Previously selected country (saved in localStorage)
- Visitor’s time zone → mapped to a country
- Browser language and region (e.g. en-GB → UK)
- Fallback default (US)
This guarantees a reliable default country flag without slowing down your site.
Customization tips
- Default country: Change the fallback from
US to your main target market.
- Styling: The snippet respects your form’s placeholder color and width. Add extra CSS if you want custom flag sizes or spacing.
- Validation: Pair this with JetFormBuilder’s built-in validation to ensure users can’t submit empty numbers.
Click to get code