2 ms·
> Demo form's phone number field accepts text, so no validation? It validates email, though. How would you validate phone numbers? Surely phone numbers must a
by lelanthran 1y ago
> Demo form's phone number field accepts text, so no validation?
It validates email, though.
How would you validate phone numbers? Surely phone numbers must allow spaces as well. Maybe allow '+27' too? Quite a lot of exceptions come to mind for phone numbers.
What if someone wants to type in a phone such as `123 456 7891 ext 21`?
What if they want to use `0800 SAVE MUNNY`? That's the number `728 368 669`.
What if they want to enter `123 456 7891 oh/123 789 4561 ah`?
- robin_reala 1y agoThe classic phone number to allow through validation is “PLEASE DON'T CALL ME I'M DEAF”.
- eviks 1y agoYou can still read 2fa codes...
- robin_reala 1y agoIf you’re sending 2fa over sms then you’ve got bigger problems.
- eviks 1y agoNo, not universally. But also, it's not the form's role to block on those problems.
- eviks 1y ago> Quite a lot of exceptions come to mind for phone numbers. That's why proper form building isn't just slapping some style over a text field. You'll have to parse it anyway, so better not delay and risk accepting errors that the user could correct right away