Back

Example: Submitting the full international number when in nationalMode

If you're submitting the form using Ajax, simply use getNumber to get the number before sending it. If you're using the standard form POST method, you should use a separate hidden input which you update on submit to send the full international number. Try submitting a valid number below, and then check the 'phone-full' parameter in the URL.

Markup

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

Code

$("#phone").intlTelInput({
  utilsScript: "../../lib/libphonenumber/build/utils.js" // just for formatting/placeholders etc
});

// update the hidden input on submit
$("form").submit(function() {
  $("#hidden").val($("#phone").intlTelInput("getNumber"));
});

Result