Chapter #52. Make it Easy for Users to Enter Postal or ZIP Codes
Postcodes and ZIP codes vary wildly around the world. Don't try to guess the format for the user: simply give them a text entry input field and allow them to enter their code. You can carry out validation if you need to on the server side. If you force users to enter a ZIP code, regardless of where they are in the world, expect a lot of junk ZIP codes in your database.
Some of the better forms that I've seen in recent years include a "live lookup", where entering a postcode (or part of a postcode) will return a list of possible address options for the user to tap or click. Obviously, this reduces the keystrokes and clicks that the user needs to make to enter their address and it also reduces error rates by pre-filling fields with data that has already been sanitized.
If you're dealing with a web page (as opposed to a native app, for example), then using the "Autocomplete" attribute on an input element in HTML will prompt some...