Hacker News new | ask | show | jobs
by afhof 4663 days ago
Nope, you should still validate your input. The correct thing to do is the validate that the input is semantically valid rather than syntactically valid. If they enter an address, try looking it up. If they enter an email, try sending a confirmation email. If they enter a phone number at least see if you can find it in a phone number DB.

Customers and users do have an interest in getting their shipping details correct. Help them get it right rather than telling them they're wrong.

4 comments

Nope, you should still validate your input. The correct thing to do is the validate that the input is semantically valid rather than syntactically valid. If they enter an address, try looking it up.

We rented a newly constructed house. The old houses in that area were demolished, but the same street names were kept. It was very annoying to have web forms doing such validation telling me that the address was invalid (you cannot have that house number in that street).

Another pet-peeve: I have an ë in my name. When I purchase some software through a web form that accepts that character, please don't just remove it or replace it with garbage in my license key ;).

I had the same problem getting internet to my rented office space. The ISP didn't have an updated db with the building's new office numbers.

I had to call and talk to someone put in a work-around. That meant I lost the discount for doing it over the web. It also meant that it took months and several phone calls for the bill to start coming to the right place.

Perhaps the message should be- "please double-check, we can't find a record of that <> in our database." But accept it if the customer insists.

this looks a bit different from the other side. When I worked at in a big retail shop we had to have forms (ie. zip/city) validation. There was a time when validation was as simple as proposed in the article (checking for presence of data, not the meaning). You wouldn't believe the things people are able to type into forms.

One of the most common errors was a bad combination of zip/city (ie. zip code for a different country area) which required a live person on the phone asking customer about proper data - it costed money.

The most unusual one was when a person managed to type gibberish in every field avaliable and than add to it a proper adress, name, zip etc... all in a three or four letter wide house-number box.

VALIDATE ALL THE THINGS!

> a three or four letter wide house-number box

That sounds problematic to begin with. I grew up in a house with a 5-digit street number.

Well exactly this is the total wrong approach. This does not work at all. For example you will find myself not in address nook neither is my mobile phone number in any public phone book. A customer knows exactly how his address is written and furthermore mail services are most of the time able to figure out where the delivery belongs to If the address is not clear. As mentioned by the other comments above, there are so many exceptions. This is a pretty good article about zip code: http://www.mjt.me.uk/posts/falsehoods-programmers-believe-ab...
There are databases which allow you to lookup addresses simply to find out if they are valid, not to reverse lookup the name. Your address is in there. Similarly, there are databases which allow you to lookup whether a phone number exists but not the name. Your phone number is in there, too.

Not being in the phone book or having a "private" number has nothing to do with your address and phone number not being in various lookup databases.

Where are those databases?
There are lots of providers that do phone verification on unlisted numbers. Here's a recent release from a quick google search: http://cardnotpresent.com/news/cnp-news-may13/TNS_Leverages_...

Tons of places do address verification and you don't need to be in any phone book for it to work. Even the USPS does address verification both paid (for businesses) and free (for non-profits).

It's pretty funny to get downvoted to zero on a true post just because someone really wishes it were true that their phone number and address can't be verified.

Your suggestions are nice, but only if not finding the phone number in any database, or not being able to find the address when looking it up shows nothing more than a notice saying exactly that.

That should be the behaviour of all such forms, even when some seemingly important information is missing.

I can't count the amount of forms in which I had to come up with some validation-passing-yet-not-really-valid postcode so I could get my order shipped to my place with no postcode, while not giving a postcode that would get the postal service to ship to the wrong place (say, 00000 or 99999 don't work, but 10000 would indicate that I want the package shipped to Troyes, when I really want it to some overseas territory - so sometimes 11111 validates and is clearly enough not a real postcode, etc).

Also... I routinely receive packages from the US with the address printed with missing or mangled accents, sometimes just for my name, sometimes just for my city, sometimes both... come on, Unicode isn't some newfangled technology anymore, you should be able to get accents right! And these accents aren't even outside the latin1 charset.

No, never ever validate anything. End of discussion.
ae;lkjtrew;lkjtashgapsroiawer;lasdf;lkkasdg;lkaweraewrpiudszvlkjsadf;ljew