Anyone have any luck or know of any phone number NPM packages that work with the current NPM plugin?
Trying to format international phone numbers in an input field. Thank you!
Anyone have any luck or know of any phone number NPM packages that work with the current NPM plugin?
Trying to format international phone numbers in an input field. Thank you!
Regex would save you a ton of time in my opinion. Or even an API that you control from the backend.
It’s not as simple as regexing a string. The issue is, that the world is such a big place and there are many formats/prefix lengths etc. USA has a very different one from Slovakia for example. I actually once back when I had time wrote a library for this that was regexing it, it wasn’t that simple to make it fit for the input, so yeah, regex is an option, but a lenghty one.
I’d suggest either just using the WeWeb’s mask input, and if that’s not enough, go for a library for full blown customization
It actually seems that the mask input’s purpose is the one you’re describing, you could do binding based on a variable, and provide multiple masks for multiple countries. It uses what you would use from NPM - iMaskJS
Since you can bind the mask, you can add a switch, and based on a country/type select even switch masks as needed.
Ohhh wow this dope going to check out. THANK YOU!
Ohhhhhhh amazing thank you