By Peter Bell

Handling International Address Inputs

How do you accept international address inputs? Lets say you have a site where most users are US, but some are international, where you want to maximize usability for US clients (do they REALLY need to type city and state in?!) but make it work for all users.

My first thoughts are as follows . . .

The most common fields for a US address are address 1, address 2, city, state, and ZIP. For international, ZIP Becomes "ZIP/Postal Code", you add a country drop down, and you need to add a region field and make sure state isn't optional. So a reasonable field list for international addresses might be:

  • Country (drop down)
  • Address
  • Address 2
  • City
  • State
  • Region/Province
  • ZIP/Postal Code

I'm excluding phone, first name, last name and label any of which might also be used for a given address.

This works, but it's not as usable as it could be, so how about we display the above fields by default, but then using a little Javascript to optimize it on loading the page for users with Javascript enabled (so better usability for most users but graceful degradation for those with Javascript turned off).

Maybe start by hiding all of the fields except for the country, then depending on the country, initially if US, redisplay address, address 2 and ZIP. If other countries, display address, address 2, city, region/province and postal code (as you can easily change the label caption to either ZIP or Postal Code depending on the country). Over time you could make this a lot more sophisticated, but it seems to me this might be the basis of a fairly useful address form snippet.

Any thoughts/improvements/cautions much appreciated - I'm kinda new to all of this front end stuff . . .

Related Blog Entries

Comments
well that structure will fail in enough locales to make it problematic. first off you can "guess" a users locale/country by their IP so you can pre-fill in country. using their locale you can then figure out which address structure to use. what we do is to "group" address types by locale--you can do the research using international postal union data, the unicode bulldog's website, etc. the tricky parts are the form's actual layout and making the backend db table generic enough to handle all these different address structures.
# Posted By PaulH | 9/7/07 12:30 PM
Hi Paul,

Interesting. So I guess you'd just preselect country from a drop down so the user would be able to change it? I always get stuck when I'm in the UK using Starbucks as everyone thinks I'm in Germany because it goes through some Detuche Telecom IP's.

Are there any articles you'd recommend for the structure of international addresses or anything you're willing to share or is that IP you'd rather keep in-house?

Thanks for the tips!
# Posted By Peter Bell | 9/7/07 12:35 PM
geolocation's not foolproof but it's >90% even w/fairly old whois data. it's success rate gets better when you combine it w/CGI.http_accept_Language data especially for picking out a user's locale. there used to be some interest in making postal address patterns *part* of what constitutes a locale.

well for resources (off the top of my head via google--i'm at home):
http://www.upu.int/post_code/en/postal_addressing_... (used to have lots of info but they seem to want money for stuff that was free in the past).
http://www.addressdoctor.com/

i suppose if there was enough interest i could open a project on riaforge & OS much of what we "know". in any case there's about 100+ countries data available most of which break down in under a dozen address structures, some of this is simply order of things--it's not rocket science ;-)

btw if you think i18n addresses are tricky, wait & see what's in store when you get to shoe & clothing sizes.
# Posted By PaulH | 9/7/07 1:27 PM
...also titles & names are tricky. in some locales, titles are super sensitive & messing them up could get you punched in the face...
# Posted By PaulH | 9/7/07 1:29 PM
A thought about using ip add. What if I'm traveling in the uk and want to ship to my house in the USA? Or I'm at home and want to ship from us to un? Or if I'm applying for something from a us location for a friend in japan the form would be wrong. I have struggled with this. I had to make a form for a user group that had an international user base. Never found a good answer. Then there's storing it and printing it out properly. My head hurts. Maybe select a country then have a puff of smoke appear over the form and when it clears there's a proper form for the country. Just an idea. Could be fun. Depends on the audience.
# Posted By john Ivanoff | 9/8/07 12:00 AM
obviously you *always* have to have a manual way to swap locale/language/country/whatever. but geolocation works right often enough (>90%) that it's the best first approach.

as far as "good answer", you need to have different address structures for each type of address which isn't all that hard to figure out from the available info (or what used to be available).
# Posted By PauH | 9/8/07 12:10 AM
Hi Peter,

I thought this was an interesting post, primarily because it strikes me as such an obvious way to annoy users. It seems that many sites treat this as a necessary item and fail to think it through. The "state" field, in particular, always annoys me when it is set to mandatory. It's fine if it is only meant to service US addresses, but as you said, for international users often it is not relevant. The worst is when there is a mandatory dropdown country field but then you are required to pick a US state irrespective of your country selection... just plain silly.
# Posted By James | 9/19/07 4:49 AM
I work as a developer for a large international shipping company. this is a difficult topic but an important one. Storing address templates in a database and asking first for the users country is a good method. A sufficient number of users seem to dislike this method.

ask for country
ask for country specific regional identifier or postal code
city town or other locality
ask for street
ask for internal building code like floor or apt
ask for consignee name

It is hard to change the fact that people seem to identify themselve in the opposite order.
And it does not help that mapping all those templates fields into a proper database it daunting.
anyway that's my two cents if anyones interested
# Posted By Joe Johnson | 1/24/08 8:48 PM
which makes geolocation guessing kind of important, at least you can take a first crack at where you think they are & bring in the address structure based on that. if you also have a way to manually swap the locale/country then at least you can let the user back out from the gelocation guess.
# Posted By PaulH | 1/26/08 10:55 PM
Paul,
How about posting a link to the information about geolocation you consider the best quick read for an executive type if I wanted them to know enough about it to give it a chance
# Posted By Joe Johnson | 1/27/08 4:02 PM
have to dig that up, but how about the facts that:
- sourceforge uses it find the closest mirror
- abc, cbs, etc. use it to prevent me from watching free tv from thailand
- itunes, etc use it to prevent me from buying cheap music online from thailand
# Posted By PaulH | 1/27/08 8:29 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.