jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers
https://intl-tel-input.com
MIT License
7.54k stars 1.94k forks source link

can you exclude the "Unknown" country from the input? #1578

Closed victorcalarasu closed 3 months ago

victorcalarasu commented 4 months ago

Steps to reproduce

  1. type +00 in the input

Expected behaviour

Could it be somehow added to the excludeCountries ?

Actual behaviour

The flag changes to the Unknown flag

Initialisation options

nothing in particular

jackocnr commented 4 months ago

So what do you want to happen when the user types "+00"?

victorcalarasu commented 4 months ago

was just wondering if it could be excluded in any way so that the user can't access it

jackocnr commented 4 months ago

Ok, say we exclude the globe image... then what would you want to happen when the user types "+00"?

Or perhaps you're saying you want to prevent the user from typing "+00"? If so, then how would you expect that to work?

anthony0030 commented 4 months ago

How about making the color of the globe red when any invalid country code is input?

PS: Also have SR-only text?

jackocnr commented 4 months ago

One thing Stripe do with their phone input, is if you type + in the main phone input, it automatically opens the country dropdown and puts the + in the country search input instead, forcing you to select a country instead of type the dial code in the phone input, which I think would be a good solution to this problem.

jackocnr commented 3 months ago

Please try the new separateDialCode option in v22.0.0 which implements the above idea.

anthony0030 commented 3 months ago

Seems to be working nicely.