I created a custom sign up form for my website’s users and I need to have their phone number stored so we can send them automated sms. For some reason when they enter their phone number on mobile it separates the first couple digits of the phone number and registers them as area codes. For example if I enter 123-456-7890 the number that would be saved in the users contact information will appear as +1 234-567-890 or even +12 345-678-90. This causes my automated text messages to fail because it’s not sending the text to these random number variations instead. Anyone know how to fix this issue? I attached the code I have below. The signup form collects the name, email, phone number, birthday and password. Part of the code also takes the user data and puts it into a CMS. I also added two images of what I typed in and what I see in the user’s contact information. In this case it just randomly duplicated the 7 as the country code. If there is a way to either drop the country code or just set it automatically to +1 instead it would be really helpful. Thanks!
import { authentication } from 'wix-members-frontend';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
import wixUsers from 'wix-users';
import { contacts } from 'wix-crm-frontend';
let emails = [];
$w.onReady(function () {
$w('#button1').onClick(() => {
const contactInfo2 = {
name: {
first: $w('#registerFirstName').value,
last: $w('#registerLastName').value
},
emails: [
{
email: $w('#registerEmail').value,
},
],
phones: [
{
phone: $w('#registerPhoneNumber').value,
primary: true
}
],
birthday: [
{
birthday: $w('#registerBirthday').value,
primary: true
}
]
};
// Creating or updating contact
contacts.appendOrCreateContact(contactInfo2)
.then((resolvedContact) => {
return resolvedContact;
})
.catch((error) => {
console.error(error);
});
const password = $w('#registerPassword').value;
const email = $w('#registerEmail').value;
let birthday = $w('#registerBirthday').value;
let phoneNumber = $w('#registerPhoneNumber').value;
let firstName = $w('#registerFirstName').value;
let lastName = $w('#registerLastName').value;
emails.push(email);
let contactInfo = {
"email": email,
"firstName": firstName,
"lastName": lastName,
"birthday": birthday,
"phoneNumber": phoneNumber,
};
let options = {
contactInfo: {
firstName: firstName,
lastName: lastName,
birthday: birthday,
emails: emails,
phoneNumber: phoneNumber,
},
privacyStatus: 'PUBLIC'
};
authentication.register(email, password, options)
.then((registrationResult) => {
const status = registrationResult.status;
console.log('Member registered and logged in:', registrationResult);
wixData.insert("Registration", contactInfo)
.then((item) => {
console.log("done");
wixLocation.to("/page")
})
})
.catch((error) => {
console.error(error);
});
});
});

