intl-tel-input icon indicating copy to clipboard operation
intl-tel-input copied to clipboard

Entering ? at the beginning of a number validates but doesn't check international dropdown

Open samwa opened this issue 4 years ago • 1 comments

Steps to reproduce

  1. go to example web site https://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/is-valid-number.html
  2. pick India as an example country
  3. enter a valid Australian number but with ? around it, such as ?+61 412 345 678?

Expected behaviour

It should return an invalid number, or switch the country in the dropdown to Australia

Actual behaviour

it says its a valid number. iti.isValidNumber() is true and iti.getNumber() returns +61412345678 iti.selectedCountryData.dialCode return 91

Initialisation options

check initialisation on example page

samwa avatar Sep 10 '21 01:09 samwa

Yeah I agree. I'd welcome a pull request to fix this. From a quick glance, I think the issue is in the formatNumber method in utils.js.

jackocnr avatar Oct 23 '21 20:10 jackocnr

Still not fixed. Writing number first and than changing flag makes always invalid number. It's a bug and a big one.

maciejcieslik avatar Jul 05 '23 08:07 maciejcieslik

It turns out even a space is enough to stop the selected country from auto-updating as you type (e.g. if you type " +44" it doesn't update). This is now fixed in v18.5.2.

jackocnr avatar Jan 14 '24 19:01 jackocnr