Back

Example: Submitting the full international number using a hidden input

If you're submitting the form using Ajax, simply use getNumber to get the full international number before sending it. If you're using the standard form POST method, you can use the hiddenInput option to automatically create a hidden input that gets populated with the full international number on submit. Try submitting a valid number below, and then check the 'full_phone' parameter in the URL.

Markup

<form>
  <input id="phone" type="tel" name="phone">
  <button type="submit">Submit</button>
</form>

Code

var input = document.querySelector("#phone");
window.intlTelInput(input, {
  hiddenInput: "full_phone",
  utilsScript: "../../build/js/utils.js?1549804213570" // just for formatting/placeholders etc
});

Result