State Selection Lists on Website Forms – How Hard Are They to Sort?
Thursday, June 14th, 2012This post certainly falls into the “nitpick” category, but the flaw occurs often enough to be somewhat irritating. The problem you ask? Drop-down lists of state names that are not ordered by the state name but instead by the state’s 2-letter postal abbreviation. Granted, this error pales in comparison to applications containing SQL injection flaws or race conditions exposing personal information, but I’m going to complain none-the-less.
What exactly is the issue? Well, it turns out that the two letter postal abbreviations (for example AK for Alaska and HI for Hawaii) can’t be used as the key for sorting the state names into alphabetical order. For the most part it works, however for some states, such as Nevada through New Mexico it breaks. As a New York resident I get tripped up by this.
The image shown here is a web form for a college admissions site. As you can see, Nevada follows New Hampshire, New Jersey and New Mexico but precedes New York. In reality it should follow Nebraska and precede New Hampshire. This order is incorrect; it is based on the state abbreviations. If instead of state names the website were displaying the state abbreviations, the order would be NH, NJ, NM, NV, NY and all would be fine.
The developer(s) of this site are not alone in their mistaken use of the postal abbreviation as the sort key. I’ve encountered this issue with online shopping sites, reservation systems and survey forms. I typically do a quick “view source” of the site and invariably they are using the state abbreviation as the actual value being passed to the server. I’m sure they are using that for sorting as well.
You might think this sort of thing doesn’t matter. From my point of view it represents a “broken window,” using Andy Hunt’s and Dave Thomas’ language from The Pragmatic Programmer. Little things count. Little things left uncorrected form an environment where developers may become more and more sloppy. After all, if I don’t need to pay attention to my sort key for state, what’s to say I won’t make a similar mistake with country or a product list or any other collection of values that is supposed to be ordered to make access easier?
Please, if you are designing an input form, make sure that sorted information displayed by your widgets is sorted by the display value, not some internal code. It will make the use of your form easier for users and garner the respect of your fellow developers.
Have you seen this flaw on websites you’ve visited? Do you have pet peeves with online form designs? I’d enjoy hearing about them.