Skip to main content

Hello, people!


I’m from Brazil. I would like to suggest a validade Brazil’s phone number, because I can get to qualify my leads here (in Brazil).

Hi Ricardo! Unfortunately at this time the only type of phone number validation Unbounce supports is to validate as a North American phone number. You could use custom Javascript to support the functionality you require, but this is a custom solution that requires the ability to write code.


We know that international phone number validation is an important feature for customers outside of North America, so I’ll be sure to update this thread with any progress we make on this issue. Thanks so much for taking the time to let us know your feature request Ricardo 🙂


Hi one thing is the validation, but even more important for us is that we can set up predefined structure (prefix) (phonenumber), is that possible?


Hi Lars! Setting up a predefined structure for phone number fields is not a native feature to the Unbounce forms at this time. This sort of structure could be possible with javascript, but this is a custom solution. Thanks for reaching out, and I’ll be sure to update this thread with any improvements we make on this issue.


Hey Ricardo and Lars,

We’ve added support for UK, Australian and Generic phone number validations in addition to North American like we’ve always had, hopefully this helps a little bit. You can see my detail response over here…


Guys, I'm having the same problem.

I'm from Brazil, and we're having problems with this number validation, because if I configure the phone number field as "generic", sometimes people fail to put numbers, making contact impossible (wrong number)

number format: (xx) xxxx-xxxx

If you can share a script that helps us with this problem, it would help, since we don't have this native option in Unbounce.


Hey @VictorAB, Happy New Year to you!

Thanks for your post. Can I ask if you’ve checked out this excellent thread on custom validations?:

 

 

I am aware that they looked at scripts for certain countries’ telephone numbers, so maybe these could be manipulated to be more specific for Brazilian numbers.

 

Hope this helps - let us know if you need further help with this :-)


Hey @Oliver_Lord , happy new year to!

@Ricardo_Barbosa im got a solution, a developer friend made a script that worked very well for this need;

In the code below, just change the variable ’seu_telefone’ to the one in the "Field Name and ID"  from your phone number form field:

 

<script>
const $input = document.getElementById('seu_telefone')
$input.addEventListener('input', handleInput, false)
function handleInput (e) {
e.target.value = phoneMask(e.target.value)
}
function phoneMask (phone) {
return phone.replace(/\D/g, '')
.replace(/^(\d)/, '($1')
.replace(/^(\(\d{2})(\d)/, '$1) $2')
.replace(/(\d{4})(\d{1,5})/, '$1-$2')
.replace(/(-\d{5})\d+?$/, '$1');
}
</script>

 

So the magic happens automatically applying a "mask" in your form field for telephone numbers (for numbers from Brazil containing the region code + 8 to 9 numbers that can be either landline or mobile).

Hope this helps too!

 

@VictorAB This is incredible thank you!


Thanks for this @VictorAB . This could help out a lot of people 🎉😎


Hey guys, new code update!

With this one, it is MANDATORY to have between 8 and 9 numbers + the area code here in Brazil, example: (41) 9999-99999 or (41) 3333-3333.

Otherwise, an error message appears and the form is not sent, deleting the incorrect number from the field.

 

<script>
const $input = document.getElementById('seu_telefone')
$input.addEventListener('input', handleInput, false)
$input.addEventListener('blur', handleBlur, false)
$input.addEventListener('keypress', handleKeyPress, false)
function handleInput (e) {
e.target.value = phoneMask(e.target.value)
}
function handleBlur (e) {
if(!phoneValid(e.target.value)) {
e.target.value = ''
}
}
function handleKeyPress(e) {
if (event.key === "Enter" && !phoneValid(e.target.value)) {
e.target.value = ''
}
}
function phoneValid(phone) {
return phone.match(/\((0-9]{2}\)) ]]0-9]{4,5}--0-9]{4}/g)
}
function phoneMask (phone) {
return phone.replace(/\D/g, '')
.replace(/^(\d)/, '($1')
.replace(/^(\(\d{2})(\d)/, '$1) $2')
.replace(/(\d{1,5})(\d{4})/, '$1-$2')
.replace(/(-\d{4})\d+?$/, '$1');
}
</script>

 


Hi @Ricardo_Barbosa 

Another no code solution to this issue would be to use Zapier to automate the checking and verification of phone numbers received through your form.

In the link below I have explained how you can automate the OpenAI and Numverify API modules within Zapier

https://community.unbounce.com/ask-a-question-41/phone-number-validation-india-1218?postid=38072#post38072

By following the guide, you can easily set up Zapier to format and verify phone numbers, ensuring accurate and reliable data collection from your forms. If you have any questions or need further assistance, feel free to reach out to the Numverify team!

Hope this helps

Christopher


@CollinsAnalytics That’s such a great solution! I would like to check it out!


Hey guys, I tried this codes below and the results are amazing. 

https://growthpedia.wiki/en-US/add-country-code-based-on-ip-to-unbounce-forms



Hey Unbouncer!
 

🚀 We have a brand new, complete solution for adding Country Codes and Flags to Unbounce!​​​​​​​

🆓 FREE Version:


💎 PRO Powerful Version:
👉 https://www.grooic.com/cfu-unbounce

 

👀 Check Out the Live Preview Here:

🌐 https://www.grooic.com/cfu-preview/

 

🤝 If you have any questions or need support, feel free to reach out to us on WhatsApp: 💬 +1 917 900 3111

Thanks,


Reply