arya-blue
luna-amber
luna-blue
luna-green
luna-pink
nova-dark
nova-light
saga-blue
vela-blue
InputPhone

International phone numbers input with initial country based on IP location lookup using https://ipinfo.io.

When setting initialCountry to "auto", you must use this option to specify a custom function that looks up the user's location, and then calls the success callback with the relevant country code.

Tip: store the result in a cookie to avoid repeated lookups.

Source

<script>
    //<![CDATA[
      var myGeoIpLookup = function(success, failure) {
        $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
          var countryCode = (resp && resp.country) ? resp.country : "";
          success(countryCode);
        });
      }
    //]]>
    </script>
    <pe:inputPhone id="txtPhone" 
                   initialCountry="auto"
                   geoIpLookup="myGeoIpLookup"
                   value="#{basicInputPhoneController.phoneNumber}">
    </pe:inputPhone>
            
Components and more
Documentation pe:
Attributes (move mouse over the names to see data types)
Name Description
No attributes available for this component.
PrimeFaces Extensions Showcase - © 2011-2025,PrimeFaces: 15.0.13,PrimeFaces Extensions: 15.0.14-SNAPSHOT,JSF: Apache MyFaces JSF-2.3 Core Impl 2.3.10,Server: Apache Tomcat (TomEE)/9.0.82 (8.0.16),Build time: 2026-02-23 00:32