Given that it seems like such a poor user experience, why does it continue to be so common?
... and amateurish work in general. And the fact that many programmers don't care about user experience.
Take phone numbers. In my country, national phone numbers are composed of ten digits, the first digit being necessarily zero. While a number can be entered as:
- 01 23 45 67 89
- +33 1 23 45 67 89
- +33 (0)1 23 45 67 89
most websites accept only the first form, independently of the fact that:
It's difficult to enter and error prone (half of the time when I type my phone number using the first form, I make a mistake... the other half I simply intentionally enter a number which doesn't exist).
It makes it impossible for a foreigner to use the form (register on a site, for instance).
Instead, what a professional developer would do is to allow any phone number¹ to be entered, and then try to parse it. Actually, it's not even that hard: Twilio does a great job of parsing numbers for you.
The same applies to postal addresses: Google API does a great job of parsing an address represented as a string.
However, it makes sense to be strict when parsing some types of fields. For instance, using a strict format for a date can be useful if you deal with multiple cultures: “04/07/2016” means July 4th, 2016 in France, but April 7th, 2016 in USA, so letting the user enter the date in any format and trying to figure out what the date is may lead to unwanted results.
Talking about spaces...
In fields which are just a bunch of numbers or characters, such as phone numbers, spaces matter. Try a little experiment: find any Windows or Microsoft Office disk with a serial number on it. Copy this number in a text editor and remove spaces (you'll end up with 25 random characters). Try to copy it by hand from the screen to a piece of paper (without moving a cursor on the screen). Now try again while adding spaces or newlines every four characters. Which one was easier?
Unfortunately, the value of spaces is underestimated by many programmers. Not only many fields don't accept spaces (phone numbers, credit card numbers), but many displayed numbers are missing spaces, which matters a lot when those numbers should be spelled during a phone call, or copied by hand (and if they aren't, why display them at all?)
For instance, my last order from Amazon displays a shipment number as 6Z00148794199. Great that I can simply copy-paste it to the courier website for tracking; less great is the fact that when I received the shipment, the agent had to copy the code by hand from my mobile phone on her computer in order to access the information. How difficult would it be for the company to display the number as 6Z 001 487 941 99?
The same order is identified by Amazon as 402-9261109-4961946. At least they made the effort to add dashes. Unfortunately, those dashes don't help much if someone has to call Amazon's support and spell the ID. Would it be so hard to write it as 402 926 110 949 619 46 instead?
Recently, I had a trip in Scotland using ScotRail. I ordered the tickets through their website, and received an e-mail containing the number CFJRC9T9 to use to retrieve the tickets at the railway station. Now how easy is to type eight meaningless characters on a self-service ticket machine, with people walking all around? Wouldn't it be much simpler if it was CF JR C9 T9 instead?
One can be quite liberal in accepting truly anything sane. Limits may be purely technical; for instance, the length of the field can be limited to 50 characters—the probability of a longer value to be a wrong number is close to 100% (if not exactly 100%.)