{"id":1732,"date":"2025-10-22T10:38:40","date_gmt":"2025-10-22T10:38:40","guid":{"rendered":"http:\/\/gogetmuscle.com\/?p=1732"},"modified":"2025-10-22T17:46:25","modified_gmt":"2025-10-22T17:46:25","slug":"phone-number-not-recording-all-the-time-on-hubspot-forms","status":"publish","type":"post","link":"http:\/\/gogetmuscle.com\/index.php\/2025\/10\/22\/phone-number-not-recording-all-the-time-on-hubspot-forms\/","title":{"rendered":"Phone number not recording all the time on Hubspot Forms"},"content":{"rendered":"

Hi there i have problem i wanted to implement select country flag from phone number and when i am testing sometimes phone number gets deleted before submited here is my full code\u00a0


<\/P>

for selecting phone country flag i am using this library\u00a0intlTelInput<\/P>

\u00a0<\/P>

<link rel="stylesheet" href="https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@19\/build\/css\/intlTelInput.min.css<\/a>” \/>
<\/P><\/p>\n




(function() {
var hubspotFormId = ‘4cf2cc85-1a88-44e0-9b65-aa3966e3ec67’;
var amplitudeFormName = ‘only6-female’;

function fireAmplitude(formId) {
if (!window[‘__hubspotFormSubmitted_’ + hubspotFormId]) {
window.amplitude && window.amplitude.track &&
window.amplitude.track(‘Form Submitted’, {
formId: formId,
formName: amplitudeFormName
});
window[‘__hubspotFormSubmitted_’ + hubspotFormId] = true;
}
}<\/P>

hbspt.forms.create({
portalId: “XXX65354”,
formId: hubspotFormId,
region: “na1”,
onFormReady: function($form) {
setTimeout(function() {
var amplitudeDeviceId = $form.find(‘input[name=”amplitude_device_id”]’);
if (amplitudeDeviceId.length && window.amplitude && typeof window.amplitude.getDeviceId === ‘function’) {
amplitudeDeviceId.val(window.amplitude.getDeviceId()).change();
}
}, 2000);<\/P>

if (!$form.find(‘input[name=”phone_full”]’).length) {
var hiddenInput = document.createElement(‘input’);
hiddenInput.type = ‘hidden’;
hiddenInput.name = ‘phone_full’;
$form[0].appendChild(hiddenInput);
}<\/P>

var phoneInputField = $form.find(‘input[name=”phone”]’).get(0);
if (phoneInputField && window.intlTelInput) {
window.iti = window.intlTelInput(phoneInputField, {
separateDialCode: true,
initialCountry: “auto”,<\/P>


geoIpLookup: function(callback) {
fetch(‘
https:\/\/ipapi.co\/json<\/A>‘)
.then(res => res.json())
.then(data => callback(data.country_code))
.catch(() => callback(‘us’));
},
useFullscreenPopup: false,
utilsScript: “
https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@19\/build\/js\/utils.js<\/A>“
});
}
},
onFormSubmit: function($form) {
if (window.iti && window.intlTelInputUtils) {
var fullNumber = window.iti.getNumber(window.intlTelInputUtils.numberFormat.E164);
var hiddenPhoneInput = $form.find(‘input[name=”phone_full”]’);
var phoneInputField = $form.find(‘input[name=”phone”]’);<\/P>

if (hiddenPhoneInput.length) {
hiddenPhoneInput.val(fullNumber).change();
}
if (phoneInputField.length) {
phoneInputField.val(fullNumber).change();
}
console.log(“phoneInputField”,phoneInputField.val());
\/\/ Force refresh validation (prevents HubSpot from wiping values)
phoneInputField.trigger(‘focus’).trigger(‘blur’);
}<\/P>

fireAmplitude(hubspotFormId);<\/P>

\/\/ DO NOT return false here to allow HubSpot native submission to proceed
}
});<\/P>

window.addEventListener(“message”, function(event) {
if (
event.data &&
event.data.type === ‘hsFormCallback’ &&
event.data.eventName === ‘onFormSubmitted’ &&
event.data.id === hubspotFormId
) {
fireAmplitude(hubspotFormId);
}
}, false);
})();
<\/P>


<\/P><\/div>\n



<script src="
https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@19\/build\/js\/intlTelInput.min.js<\/A>“>

\u00a0<\/P>

\u00a0<\/P>

i have also enable rechaptcha for my form, i had disabled any validation for phone field and sometimes phone is recorded sometimes not also phone field is optional.<\/P>

\u00a0<\/P>

If somebody can help\u00a0<\/P>

\u00a0<\/P>

Thanks in Advance<\/P>

Toni<\/P>

\u00a0<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"

Hi there i have problem i wanted to implement select country flag from phone number and when i am testing sometimes phone number gets deleted before submited here is my full code\u00a0for selecting phone country flag i am using this library\u00a0intlTelInput\u00a0<link rel="stylesheet" href="https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@19\/build\/css\/intlTelInput.min.css” \/> (function() {var hubspotFormId = ‘4cf2cc85-1a88-44e0-9b65-aa3966e3ec67’;var amplitudeFormName = ‘only6-female’;function fireAmplitude(formId) {if (!window[‘__hubspotFormSubmitted_’ […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1732"}],"collection":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/comments?post=1732"}],"version-history":[{"count":1,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":1733,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/1732\/revisions\/1733"}],"wp:attachment":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/media?parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/categories?post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/tags?post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}