Okke's blog

Sunday, March 12, 2006

Textbox input - Let the computer do the parsing!

When I was trying to order something from a Dutch webshop (informatique.nl), I got stuck at the order form. I had to fill out my zip code. A dutch zip code is in the form of 1234AB. Or 3825PP. 4 digits, followed by 2 letters. But somehow, I was making a mistake in the form. Well, I wasn't. The form was making a mistake. My zipcode, 1234AB, was INVALID! After 10 times trying to retype the thing, I tried adding a space in between the numbers and letters. Guess what? It worked. "1234 AB" was OK, "1234AB" wasn't. That's stupid. With a simple check, they could've covered both cases. Just delete all whitespace and illegal characters from the field, then check if it matches the basecase: 1234AB. If they'd done that, I would've been enjoying my purchase. Now, I was frustrated. The same goes for telephone numbers... Should I type '0561 602134' or '056 1602134' or fill out in 2 boxes? Or '+31561602134'? or '0(031)451602134'? Just allow all of these options! Just delete all whitespace and other illegal characters, and let your system take care of proper formatting. Don't make your customers think, because they'll be pleased if they don't have to.