Snail mail envelope addresses are not structured internationally. Although there is a standard format in the US, and there is one in the Netherlands, they are very different. There are small but significant differences between the different European countries. Americans often find this strange, but they usually don't realise that we don't see Europe as a whole yet. For me, France is as foreign as the US, while people from across the Atlantic sometimes "go to Europe". We don't even go to "Asia" or "Africa". Even though Belgium is at bicycle-distance from where I live, I don't often go there. It's another country. And yes, it feels funny to be able to pay with your own currency in foreign countries :).

But I was going to rant about paper envelopes. As I said, there are different formats. A web developer cannot know all formats, and if they do know all formats, that's not even enough. Not enough, because sometimes someone needs an address written in a specific way to ensure the thing reaches its destination. For example, I let packages be delivered at work. Because multiple companies share one street address, the company name has to be on the envelope. But this doesn't automatically mean I want my company to have anything to do with the purchase.

Dutch addresses have "$street $number", French have "$number $street". Belgium is bilingual and has both these languages and both these formats. But if you think you can have your database handle that, guess again. Some people want to specify it as "$street_dutch $number $street_french", e.g. "Kolonel Bourgstraat 12345 Rue du Colonel Bourg".

Possibly more than zip and state (or equivalents) is needed. Perhaps less is required. We have provinces, not states, but this information is never on the envelope. If your database is international, should it then have a column for each possible piece of information? And a bitfield column to indicate which fields need to be printed? Or something that specifies field order?

Your envelope or package will probably arrive if we fill in your form with weird information, but there's a big chance its delivery is delayed by days.

How to fix this? Well, if you want country and such in your database in separate columns, because you think you can create useful statistics from that, or calculate shipping costs, or whatever, go ahead. But if you want to actually ship something, provide an unrestricted HTML textarea for the full address. Instruct users to enter in it what they want on the envelope, including everything. Make sure they understand that they need to *repeat* the country name if you also let them pick it elsewhere. Optionally, provide a check box "Generate a standard US address from the information provided above".

Textareas aren't used often in order or subscription forms. This is not because it's the wrong solution, but because most people are unaware of the trouble strangely formatted envelopes can cause.

Oh, and names are also a good reason to not use separate columns, or to at least provide a free form input field: Some use "$firstname $lastname", others use "$lastname $firstname" (of course, the variable names firstname and lastnames themselves are flawed), others uc() their $lastname, some people don't have or don't want to let know a certain part of their name. Heck, brian d foy himself knows best how picky people can be about how their name is written :). Some names are one character in size. I once met a boy whose first name was K. Pronounced not Kay, but K, with no vowel. Regardless of what you think of this, this is someone's name, and your form should not assume every name follows a certain format.

Bottom line: provide free form input fields and think twice, no, thrice before making any field mandatory.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re^2: The Perl Review, with cheaper subscription options by Juerd
in thread The Perl Review, with cheaper subscription options by brian_d_foy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.