> From those 5 characters you can determine the city, the state, and the country
False. Many zip codes include more than one city, and some even cross multiple states. And you can't always tell the difference between codes from different countries. Now you're not just instantly filling the rest of the form, you're implementing fancy multi-country filtering logic, editable drop downs, etc. Given the obvious incompetence of the people implementing most web forms, you're asking for disaster here.
Instead, learn to use your browser's autofill feature, and design your sites with it in mind. If you do it right the user literally doesn't have to type a single character. That's even better than typing a numeric code. Sadly even this seems beyond the abilities of the people who implement web forms.
This 1000 times. I’ve tried implementing what OP has mentioned, and quickly learned it isn’t possible. A city can also exist in multiple zip codes. And there can be multiple cities with the same name in the same state. So, to be safe, you have to enter city, state, and zip.
These details don't detract from the efficiency. The postal code can prefilter every other field which can frequently narrow down to one. I would leave the ability for the user to override with free form data entry as data isn't perfect and changes over time.
The linked article feels like it is going to get linked in a response article titled "Things you don't know about zip codes" in the next 48-hours to a week.
> Instead, learn to use your browser's autofill feature, and design your sites with it in mind. If you do it right the user literally doesn't have to type a single character.
Funny that the best solution is circa-1997 Netscape 2.0-level technology, while everyone iterates on how we can make everyone's life worse with even more unnecessary JavaScript. Like we all collectively forgot what the <FORM> tag does.
To type an address on a letter, something a 5 year-old could do with a crayon.
Address forms, with unnecessary and unhelpful drop-downs, many of which reject keyboard input and require use of a mouse to scroll through them, are the bane of my existence.
If something is more efficient 95% of the time, and as efficient as normal for the rest of the time, its still a good solution.
if there are multiple cities, then just don't auto fill
that way it's faster and easier for 90% (just a guess) and no different for folks that have multiple cities on that zip
GPS coordinates is the answer.
yeah - I do think zip first to bring matching things to the top of your other dropdowns and lookup results (not filter, just prioritize) is almost certainly a good idea, but it's very much not an always-match.
Or if theres a collision dont autofill it. The rest of us will be glad you autofill for us.
I'm always struck at how the state abbreviations are alphabetical order of state name. This leads to the abbreviation not being in strict alphabetical order.
I'd be fine if it autofilled one city from the zip code, which for me is always wrong. I can tab to the field and type in the correct city. Don't even need a drop-down with the possible cities. And if I don't fix it, it doesn't really matter for USPS. They just care that the ZIP is correct.
This. I have to fill out a form that requires uses the ZIP code to look up cit(ies) and state, but often has multiple options for county, which I have to look up in a separate tab independently. It's not the huge time saver it should be... unless we start including ZIP+4, but I couldn't even tell you my own address with +4.
USPS doesn't care; each ZIP code has a single preferred city name and a list of acceptable alternate city names to account for cases in which a ZIP code spans multiple cities. However, USPS's address validation will prefer to use the preferred city name for the ZIP regardless of whether the recipient actually lives within the boundaries of that city. That's because USPS has opted to organize addressing entirely around the ZIP codes, and other political boundaries are irrelevant except in cases of problems interpreting the address.
This does mean that you might autofill a city name that is "wrong" in the view of the person completing the address form, but much of the bulk mail they receive probably uses that city name anyway.
Technically speaking ZIP codes are not "supposed" to span states but, in exceptional cases, some do. In this case USPS handles it the same way: the state of the preferred city is the preferred state for the ZIP code.
The preferred city is almost always the location of the post office serving the ZIP, which makes this situation fairly intuitive. You can find some interesting edge cases where a post office in located in a suburb city, resulting in a ZIP that includes part of a major city having the suburb as its preferred city name.
You can look up the city name and alternates for a ZIP here: https://tools.usps.com/zip-code-lookup.htm?citybyzipcode and the Domestic Mailing Manual covers this, although it's scattered across several sections and mostly part of how the City State database (the database used for validating city and state names in addresses) works.