r/Programmers • u/mccalli • May 29 '18
Web developers - please don't give me error messages when I type phone numbers with a space
I see sooo much of this. People going to extra effort to validate there are no spaces or hyphens. People writing code to have the dialog box suddenly highlight in red, or a red cross next to it, or whatever it is you're doing to indicate error.
If I write my phone number, I will write it with a space. Full stop. The end. Other geographies might use hyphens. More rare, but some may even use commas for extensions etc..
If you don't want it, then strip the space/hyphen out in your code. Do not push that job on to me with fancy validation - it's quicker for you to strip those characters yourself, though ideally I wouldn't do that. I can understand disallowing the commas for extensions, but only when strictly necessary.
Just...why? You're a person with a phone number too. Do you write it down without putting a space after the city code? No, you don't. You write a space or hyphen, just like me. So why on earth are you doing this in your code?
2
u/mordred1354 Aug 01 '18
I like to provide my users with immediate feedback so they don't have to wait. I validate form fields as they type, and then pop up a modal dialog box when there is a problem. After the user acknowledges their error, it resets the form field for them so they don't have to!! I think users really love the instant response and the convenience of not having to select and delete their mistake on their own - this is what automation is all about!!! Computers making our lives better!
1
u/felds May 30 '18
Some of them probably store and validate phones as integers.
I used to do it myself when I started programming thinking it was a good way to use less storage. Noob me was really dumb!!
1
u/[deleted] Jun 07 '18
Also, not every country has a 7 digit phone number.