4

I have a form with city, state and country fields. The design makes the user select the country, then state, and then if the item is not found, they type the name of the organization, followed by city. Roughly 5% of people type "City Name, ST". e.g. "Boulder, CO" or "Boulder, Colorado". There are cases where a comma makes sense, such as "Brooklyn, New York".

Is there any good solution to this problem?

Edit: We have 30% international addresses, so zip code tricks don't really work.

Update: I like Keno's idea of validating post comma text... show a soft error when there is a comma.

1
  • 1
    In what way does the user typing the state break the system? Your system seeing the situation and adjusting accordingly is the best solution. Commented Oct 17, 2016 at 0:47

3 Answers 3

10

Try using autocomplete where the user starts typing and gets a list of cities and their corresponding states.

enter image description here

Pros:

  • Users never have to type the full name.
  • Users can never misspell a name.
  • Less need of error messages and error handling.

Found an API that might help you.

2
  • This is nice, saves typing all of very long city names. It shouldn't be an absolute though-trouble is what if someone is overseas? What if someone lives out in the sticks and their town isn't registered in the system? Commented Oct 17, 2016 at 10:12
  • I am not sure how it works "over there" but i guess that all possible locations could be in the system. If not, just ad that location to the system. Commented Oct 17, 2016 at 10:27
5

You can automate the city (and state) field by asking for the user’s ZIP code first. Every code correlates with a specific state and a developer can use a tool / API that will put the right city and state into the fields after the user types in the ZIP code.

Automating the city field prevents user mistakes and the time spent to complete the form is shorter.

Update: Some comments suggest the automation can fail.

Even a lot sites make the user enter their zip code first (see Apple), and then auto-populate the city and state based on it, you can have some issues developing this.

enter image description here

Some zip codes can generate a result with multiple cities/towns/etc within them. This means you may need a select/ dropdown with the options from the array of cities and allow the user to select the correct city. Anyway, the country is already selected in this step, so the format for the zip code is known.

Also, provide a way for someone to successfully complete this form without the zip code.

The suggestion dropdown can have more problems in development, but the idea is good too (an automatic suggestion dropdown as you type your state). This requires more interactions than the first method and this method requires a database of all possible city names.

Resources (this is just to see there are a lot of great tools there):

35 zip code APIs

Get City Name from Zip Code google geocoding

Google Maps APIs

5
  • Given that zip codes can cross city boundaries, that there are over 43,000 zip codes and that zip codes are not constant, how would the user interaction change when the automation fails? Commented Oct 16, 2016 at 20:32
  • 2
    @EvilClosetMonkey Postal codes are not unique by country, but the country could be a field before the zip code. Also, in development, an API version updates can be automatic or supervised. If the automation fails, the inputs/ selects with the country and state can be filed manually. I suggested a solution that helps, not necessary replace the functionality. Commented Oct 17, 2016 at 3:55
  • 1
    You could certainly use the Zip code to narrow the list and then, if there are any options, present them as drop-downs or Radio buttons. Commented Oct 17, 2016 at 9:30
  • 1
    I am really curious if there has been any studies on the usability of these enter the post code first and then select your address systems. I personally find them rather annoying. Typing my post code then scrolling down to my address can take longer than just typing my address Commented Oct 17, 2016 at 10:10
  • 1
    @theotherone, from a purely logical point of view, the data that you get from hand typed addresses can vary greatly in quality which, in the longer term, could lead to a bad perception of the whole service if the final product in not delivered correctly (look up the 'peak-end rule'). Whereas, the quality of data gained from look-up forms is consistent and, usually, high quality. I would be prepared to bet that a tiny bit of frustration at the address point would be preferable to the frustration of having to chase mis-deliveries sent to non-existent addresses. Commented Oct 21, 2016 at 10:44
3

I would validate everything after a comma in that field and advice:

validate after comma

5
  • Is a comma always entered by every user? An adaptation of this might be to check backwards from the end of the input to see if you can match a state/abbreviation preceded by a space. Commented Oct 17, 2016 at 7:57
  • If you're going to the trouble of checking the content after the comma then why not compare it against a checklist of states and use that to populate the State field - Asking the user these questions won't help as they're unlikely to ready the full question. They'll get as far as "Are you sure" and just think 'Yes, I'm sure' and dismiss the alert. Commented Oct 17, 2016 at 9:28
  • @AndrewLeach : The regex would check for a comma and then validate after that
    – Keno
    Commented Oct 17, 2016 at 17:10
  • @AndrewMartin : The question as I understand it was checking that states were not included in cities, but permissive of special comma separated cases. As for your last comment I don't know A/B, or hard data, everything else I would be speculating.
    – Keno
    Commented Oct 17, 2016 at 17:11
  • @Keno, the form described also includes a field for 'State'. I was just pointing out that, rather than bombarding the user with alerts that they probably won't read properly, you could simply take that information and put it where it belongs. However, this is somewhat moot as the from should be designed in such a way that makes the entry of bad data impossible - such as the zip solution proposed in another answer. Commented Oct 18, 2016 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.