Address field [was: Integers with leading zeroes]

Chris Angelico rosuav at gmail.com
Wed Jul 22 06:59:21 CEST 2015


On Wed, Jul 22, 2015 at 2:31 PM, Jason Friedman <jsf80238 at gmail.com> wrote:
>> Of course, most of the
>> time, I advocate a single multi-line text field "Address", and let
>> people key them in free-form. No postcode field whatsoever.
>
> I'm curious about that statement.
> I could see accepting input as you describe above, but I'm thinking
> you'd want to *store* a postcode field.

Actually, no. Apart from statisticking, there's not a lot I can do
with a postcode. Due to the nature of international addressing, it's
usually safest to go to one extreme or the other: either full-on
address validation that knows about every delivery point in every
nation that you support (viable if you support only one country, and
that country's postal service offers an API - happens here in
Australia), or no validation whatsoever, and a simple free-form field
for people to enter what they will. Most of the times I've been
setting things up, they're too low-end to justify the former, so I
recommend the latter. Sure, there might be typos... but there might be
those anyway, with a classic multi-part form. (I do recommend having a
drop-down select box for the country, incidentally. That's easily
validated.)

Storing postcodes works nicely once you've settled that they're all
part of a single country. When you want to do statistics on postcodes,
it's not usually too hard to rip them out of the blob and work with
them, but they're unreliable anyway unless you've gone the full-on
validation route. So I tend to just not do the stats at all :)

ChrisA


More information about the Python-list mailing list