views:

141

answers:

5

I am planning to design an address validation for users registering in my app. Possibly validating by zipcode and state.

Any idea how to handle addresses from around the globe?

Do i need to insert all the zipcodes in the database and then validate the address. Any possible suggestion for the implementation?

Thanks and Welcome :) Krisp

+3  A: 

Since there is no international standard for zip codes and a list of all zip codes in the world would be out of date before you were finished putting it together, I suggest a smaller approach:

Identify the countries that you will have to handle most and develop seperate validation rules for each of them. Make certain that with this you handle a vast majority of your users (e.g. 95%, or98%). For all the other countries, just accept what they enter vithout further validation.

There are so many different address formats in the world that it is just not worth the effort (if at all possible) to handle them all.

Treb
+2  A: 

There is MASSIVE variance among address and postal code formats, such that there is not any "standard" way of doing this. See "Frank's Compulsive Guide to Postal Addresses"...

How much/what kind of validation do you really need? If the user is entering their shipping address, for example, they're more likely than you to know what particular format their local postal/shipping provider needs. Just give them a multiline textarea to enter it. If you need parts of it to calculate shipping costs, request just the information you need (City/Country, for example)

GalacticCowboy
A: 

Hey Thank you so much for the link. it will surely help me out.

I completely agree that it will be very difficult to acheive 100% validation for this. but i want to avoid a multiline text area because it adds on to manual validation of the address.

as suggested surely i will try to put validations for the majority of the users and rest all i will let them enter as it is :(.

A: 

Postal Codes can actually be a headache because in some places they can represent very tiny areas as opposed to the US where they often represent relatively large areas (except in a big city where they may represent a few blocks).

Look at Canada, their postal codes can actually represent very very tiny areas. Two stores on opposite sides of the street often have different Canadian postal codes. Also in a list of Canadian businesses, when merging the list it is not uncommon to see the same address with a slightly different postal code. This just indicates that a lot of people get it wrong. On a customer basis I don't know how realistic it is that they actually get their exact zip code right.

http://www.columbia.edu/kermit/postal-ca.html

Basically it seems that each apartment or business dwelling may get their own zip code, which would make sense based upon what I have seen with Canadian business addresses.

The other point is that this is just Canada. Each European country will have its own address/postal code, so will Australia, Russia, etc... If you really want to do address verification, this is a major project.

To actually verify the address you need to to verify the postal code, city, and street. In the US the census releases the TIGER database files which often have a list of streets. But for other countries I don't know how you can get a list of streets. It may be best to look into a commercial package (maybe one of the GIS packages, although a lot of them only offer detailed addresses for the US/Canada and sometimes a few European countries).

Cervo
A: 

International address standards are at www.upu.int

The US standard address format is Publication 28 at usps.com

ZIP codes are insufficient for validation per http://semaphorecorp.com/cgi/zip5.html

joe snyder