-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phone words are displayed as invalid number #1894
Comments
Can you describe your use case, for why your users might want to enter their number using phone words? |
Yes, so I am currently working on a form builder plugin where users can create a form, add various fields and use those forms across their websites. The users had requested the feature regarding phone number field accepting phone words as well. This was initially working when I was using v18.x.x and now I have updated the library and this stopped working. Also to give you some additional insights, if I use the internal utils function |
Ok, well as you say, we previously accepted words in numbers as valid, but several people complained about this ("What if a user types an alpha char by accident, it shouldn't say it's a valid number"), and now that we've changed it to reject words in numbers, you're the second person to complain about that, so I think we need an option for this, so people can decide for themselves if they want to allow it or not. We could call the option
I don't have time to implement this myself right now, but would be open to a pull request. |
I see. I think I misunderstood the code a bit. So currently is the |
That condition is true if there are any alpha characters in the number (including either phone words, or "ext" extension signifier). Then inside the block, you can see the comment explaining the logic:
So since we decided to reject phonewords as invalid numbers, but accept numbers that contain extensions (which have the word "ext"), we now split the typed number on the first alpha char, and check that the digits before it are a valid number on their own. |
Plugin version
v24.8.1 but the issue I think persists from v20.0.0. as it is working properly in v19.5.7
Steps to reproduce
Expected behaviour
It should accept the phone number as it is a valid number (checked on
libphonenumber
). These are called as phone words, more about them here.Actual behaviour
It shows invalid number.
Initialisation options
utilsScript
(loadUtilsOnInit with v24.8.1) andinitialCountry
The text was updated successfully, but these errors were encountered: