The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Typical Country / Region dropdowns

My user registration screen needs to have drop-downs for country and region. When the user selects a country I want to populate the region drop-down with the appropriate values. Does anyone know where I can get an xml file or similar containing the data of all countries and their regions?

Something like:

<country name="Australia">
<region name="Queensland"/>
<region name="New South Wales"/>
</country>
...

Thanks
Liam McLennan Send private email
Monday, February 05, 2007
 
 
On behalf of the web using population can you not use the full list.
I don't need to scroll past Afganistan, Azerbijan etc to get to the handfull of countries you actually have customers from.
Martin Send private email
Monday, February 05, 2007
 
 
"I don't need to scroll past Afganistan, Azerbijan etc to get to the handfull of countries you actually have customers from."

I think Asshole-Land is right between those two.

Be a bit more tolerant of other nationalities, eh?
Internationalist
Monday, February 05, 2007
 
 
As far as I can tell, there are no country lists in XML format. More to the point, as Martin implies, the inclusion of a name on the list, and more importantly, the proper spelling of a name is something of a political issue.

For example, the Democratic Republic of the Congo apparently wants to be called Zaire nowdays. When I looked around this morning, I saw a list over at the Library of Congress that contained both names, despite the fact that Zaire changed its name in 1997. It makes sense for them, but it doesn't necessarily make sense for your business.

My advice: just grab a list from somewhere, throw it into a text editor, eliminate the obvious ones, XML'ize the rest, use it and be prepared to change it when people protest.

(Tip: when creating the drop down list, force the US, Canada, the UK and Australia to the top before populating the rest of the control.)

Alternatively: if your online merchant account has a list, borrow theirs.
TheDavid
Monday, February 05, 2007
 
 
dev1
Monday, February 05, 2007
 
 
Try OpenOffice.

I've picked out several interesting lists from OpenOffice before such as Avery label definitions. It took a bit of hunting, but eventually I found the right file.
anon
Tuesday, February 06, 2007
 
 
Change it when people complain? Fat chance. Then someone else would complain that it was changed.

I ended up compromising. I have a dropdown of countries but region (state) is free text.
Liam McLennan Send private email
Wednesday, February 07, 2007
 
 
I found something close to what I wanted at codeproject.com but it wasn't enough, so I created my own. I load the values from configuration so that I can change them and their order. I also created a currency drop-down. Both controls use the ISO codes (country and currency respectively) for their values. Since these seem like useful controls I have made the controls and their source code freely available on my site.
 http://www.eclipsewebsolutions.com.au/FreeAspNetControls/CountryandCurrencyDropdownControls/tabid/69/Default.aspx
Liam McLennan Send private email
Saturday, February 10, 2007
 
 
It'd be very easy to convert the ISO 3166 listings into an XML language, if that's really what you'd want to do.

Why would you do that, that's another question for another day.
Steve Hirsch Send private email
Sunday, February 11, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz