DoSomething / voting-app

☑ Voting app for DoSomething.org campaigns.
MIT License
6 stars 4 forks source link

BR number format suggestion invalid #472

Closed deezone closed 8 years ago

deezone commented 9 years ago

The suggested number format in the vote submission form for Brazil does not validate.

image

but a submisison following the suggested phone number format produces a form submission error.

image

Suggested Format:

DFurnes commented 9 years ago

I found this super nice Laravel phone number validation package, based on Google's libphonenumber. From some testing on my local machine, it works great for US numbers and 10-digit BR numbers, but not 11-digit BR numbers.

Still trying to figure out what's up with that, but another potential quick fix could just be updating our regex to be less strict (and then perhaps updating to better validation post-launch).

DFurnes commented 9 years ago

One really cool thing about the package mentioned above is that it can validate a number by country code, so we could prevent people from entering a BR phone number in the US (and vice versa). The flip side is that in some cases that might disallow numbers that carriers would consider local. From a docblock in libphonenumber:

For example, this method will mark numbers from British Crown dependencies such as the Isle of Man as invalid for the region "GB" (United Kingdom), since it has its own region code, "IM", which may be undesirable.

Not a deal breaker, but we should make sure there aren't any cases like this for MX or BR!

/cc @DeeZone @classicfreddie

DFurnes commented 9 years ago

Just for future reference, there's some further discussion on this happening in #477! :page_with_curl: