tags:

views:

254

answers:

3

Microsoft's live service has an amazing contact details form in their "Account" > "Registered information" page. You are first asked for your country and the rest of the contact form changes accordingly. For example, if you select "United States", the form fields will change to: Address 1, Address 2, City, State (drop down of US states), ZIP code, Time zone (drop down of US time zones in a user-friendly form, e.g., "Eastern Time (EST)").

If you select "United Kingdom", the form fields will change to: Address 1, Address 2, Address 3, Second City, City, Country, Postal Code, Constituent Country (drop down) and Time zone (drop down).

This contact form provides the best user experience I have ever encountered in a contact form (I may be over sensitive here but enhanced user experiences excites me and I want to provide the same experience to my users).

Is there a way of creating such a form using VS 2008/.NET 3.5? Is there a legal way of getting hold of their information database?

A: 

Regarding getting hold of their database, I am not sure. Maybe this is cataloged somewhere, which fields are normally used for each country.

When it comes to implement this different forms for different countries, there are a few solutions. One would be to have different usercontrols or customcontrols, one for each country that you want to offer a differentiated form. Each of these usercontrols would be a form, with textboxes etc and would know how to save its data.

Another way is to have that information (which country requires which type of controls and labels) in some sort of repository (database, xml file etc) and create those forms dynamically.

This can get quite complicated and "meta" really fast though, so it's a question of how complex you want it to be in terms of cost/benefit.

rodbv
A: 

Having worked with systems that did similar "tricks", much of the time it's based on information that is either available through meticulous searching, or can be purchased from government agencies for a small fee. For example, a system I used had a handy feature that if you typed in the zip code for a US address it would look up the values from a database table that had been populated from a list purchased from the US Postal Service.

In the case of what they have on the Windows Live account page, I'm going to guess it's something similar to this. They just have the relationships set up for country to state to city, etc. It would be great if there was a model of this existed for people to use, but to my knowledge it's reinvented for every app.

Agent_9191
A: 

Most address data breaks down to similar information anywhere in the world -- the neat trick is labelling it for the destination locale ("Postal code" vs. "Zip code") and hiding the UI for fields that are irreverent ("Constituent Country" won't mean a great deal for Luxembourg, for example).

Working out the "relevant" fields/etc. and building a cross reference for each country into your code should be relatively trivial

Rowland Shaw