Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Address Form With No City State (just Zip Code)
2 points by Johngibb on May 8, 2011 | hide | past | favorite | 8 comments
TL;DR; How do I automatically infer city/state from zip code, and ask for clarification if ambiguous?

I'm building a website that needs to collect the user's address, but I absolutely abhor typing in city, state, and zip code. It seems redundant.

However, I'm aware that there are sometimes more than one city that corresponds to a single zip code. Apple's checkout page has an interesting solution: when you type in the zip code, they perform an AJAX lookup, and show you the city state if it's not ambiguous, or give you a drop down if it is (see: http://www.lukew.com/ff/content/apple_checkout_zip.gif).

Has anyone built something like this? Is there a good database or API available for determining cities and states from a zip code?



Here is a great post that was posted on here: http://uxmovement.com/forms/innovative-techniques-to-simplif...

And here is the link directly for what you're asking: http://forumsblogswikis.com/2007/08/15/using-ajax-to-get-cit...

Good luck


That's silly, many users expect that. What you can do is geolocate their country so they don't have to select their country but other than that I still ask them to type in their city and state...


I still ask them to type in their city and state...

Why? I am sick to death of typing my name and address in stupid forms that aren't tagged properly for my browser to fill them in. Zipcode I can live with, and is not that big a deal to look up.

What annoys me even more is on some form where I am typing in my full address and it can't even work out what my zipcode is. How about doing a little validation, and taking the opportunity to impress the client during the otherwise-tedious signup process?


I think the larger issue that is bugging you is the fact that user's data on the web is no longer owned/exchanged by the user but by the properties that the user interacts with. It frustrates me too, believe me. I would much rather visit a site that asks me for my FOAF (contains relationships to friends, profile data, &c...) URI, and a cert to authenticate me (this is called FOAF+SSL) - then automatically load and cache (for say, a month?) my FOAF profile data. Thereby never requiring me to enter anything more than once except for my FOAF URI path.

Sad thing is, it isn't the providers that can't adopt it - the technology exists; it's the users. Users are locked into a model that is out-dated and are also locked into their own laziness and ignorance (many users would be scared off by the very mention of "FOAF" let alone maintaining their "own" FOAF file).

But, here are some of my counter arguments to your comment:

A) some users (I'm one of them) don't always use my actual IP to register on a site, I use anonymizing services often so I usually get frustrated by geolocating/ajax auto-fill forms and give up on a site that doesn't do any sort of graceful fallback

B) AJAX isn't effective when your user can't use Javascript (have you tried using your site with a screen reader? Can blind people use your site with ease?)

C) The act of typing in your address really is not that painful - I specifically set my forms with the autocomplete="off" attribute so user's personal data isn't being stored by their browser in the name of "convenience" (particularly billing forms that ask for your address data and cc data)


I'm not following your arguments. If a zip code can 95% of the time uniquely identify a city and state, why make them type it in? Sure it's not "THAT" painful, but neither are a lot of small things that add up to making a big difference.

As for the AJAX / javascript disabled issue: just because it's possible to use AJAX in a way that locks out some users, doesn't mean it's necessary. There are definitely techniques for unobtrusive javascript that fails gracefully, and that's exactly how I'd like to implement this.


No, the issue that is bugging me is the one that I actually articulated. I have a FOAF file, I'm disappointed it hasn't taken off, and I sometimes use OpenID.

a) I'm not asking you to work out my address/zip from my IP.

b) If I had javascript disabled then that would be a problem, but since I don't then I'm OK with you putting things inside the script tag.

c) How do you know what's painful for me? You're not my parents, and I didn't ask you to protect me from my own browser settings. I especially don't appreciate it when features that I spent time configuring (like autocomplete) fail to work because you think you know what is good for me.


PS: Here's the original blog that was the source of the apple image: http://www.lukew.com/ff/entry.asp?968


Please see http://gibb-test-address.heroku.com/ for my attempt at solving this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: