Mindless Rambling Nonsense
Paul D'ambra
pauldambra on github
pauldambra on twitter
Fri Jun 10 2011

Get with the program(ming)!

Twice recently I've hit the same problem with two different mobile phone vendor's websites. Vodafone (displayed here) and 3. When I type a phone number I split it into three sections using white space. "nnnn nnn nnnn" that's how I remember numbers. That's not uncommon I don't think…

using a dash in an input

nor is it odd to use a dash.

So why do I need to learn how your website wants phone numbers formatted.

Whack some javascript on your page… you must be using it for something!

var correctedNumber = numberTypedOnForm.replace(" ","").replace("-","");

and with that massive development cost you aren't going to make someone type a number twice just to satisfy your database server. Yes, not everyone will have javascript turned on and it won't catch everyone's weird way of typing phone numbers


but it's about not introducing a pain point for customers when you don't have to

If you want to be really fancy you could

var correctedNumber = numberTypedOnForm.replace("/\D/g","");

Computers are supposed to make our lives easier but it's up to you website developers to help them help us.