Retool forms phone number country code

Any ideas how to fix this team?

Thanks!

1 Like

I'm currently facing a similar issue. Even tried to set the default value as '+971' , the UAE country code. It works in the editor but in my public link i get the following. Did you manage to find a work around ?

image

Also when i continue to fill in the form it corrects it self to the right country. Feel like there's an issue with the default values of the phonenumber input.

image

1 Like

Me too. It should be a bug of Retool Form, and I also can not find workaround solution.
currently also have to set default value to get the correct phone number, and then only country flag is wrong.

if you put a default value does it still happen or is actually typing the only way to get it to show the correct country code?

Yes even with default value set to '+971' it shows us flag as phone country code in public link. As soon as i type a number it correctly identifies, i'm assuming it's a state issue

Hey everyone! Thanks for all the feedback here. I've submitted a bug report to the team for this and will update you here as I get any additional information to share.

3 Likes

The discrepancy between default value and the country flag (when the form loads) also happens outside Retool Forms, in a "regular" app.

Hy @casey_hemingway
If you want to lock country code then there is an option provide by phone number component in interaction setting like:
image


by doing this you can lock the country code.

4 Likes

Do we know yet when this can be fixed?
I have the same issue for my public webpage

1 Like

Hi @joeBumbaca, is there any update on this issue with the phone number input?

1 Like

@chuksjoe No updates right now, we will pass along any new information here as we get it.

6 Likes

The phone number country code thing in Retool forms can be a bit tricky! In my experience, having a dropdown list for country codes is super helpful in making it easier for users. That way, people can pick their country instead of typing it all out.
I’ve found that using a verification phone number system can also help streamline things. It can ensure you get accurate numbers and add an extra layer of trust. Just remember, it’s all about making it as easy as possible for folks to input their info. If you want to dive deeper, checking out verification phone number might give you some valuable insights.

3 Likes

Still seeing this issue, it appears to be defaulting the country code to match the language localization of the browser. Testing from Finland with a "locked country code" of US, I get a british default (browser language is british english), whereas my coworker gets US (us-english) and another gets sweden (Swedish).

So, the initial default appears to be inheriting from the browser settings. Also noting, using Firefox I don't see the value updating when I start typing a phone number, it remains +44.

This would be very helpful to get this fixed, as we do primarily focus on markets in different countries including the US, and we can't assume that everybody has the the "correct" language set for their country.

1 Like

this is a bit off topic, but I thought I'd share the regex to validate phone numbers since verification was mentioned:
^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$

if you're using Retool DB (postgresql/sql) you can implement the verification in the database itself instead of on the front-end. the benefit here being that the front-end no longer has to handle invalid data both when reading and writing (otherwise if you have more than 1 phone number input you have to remember to validate it for every instance.... so if a bug appears, you would have to remember to fix it everywhere you use the phone input)

1 Like