1

I have a page that allows people to choose a country and then search for a street address in that country, it is very similar to this example from Google. However (and you will notice that it happens in the example as well) if you start typing something such as "new" while U.S.A is selected and then switch to another country, when you click back on the input field the old country results will show up.

Is there a way to clear or reload the results based on the new parameter? I tried searching the API docs but I couldn't find anything.

Edit for clarification: I am able to do everything correctly, the issue I am having is when changing the country when you click back on the input field the old results show up. If you make a modification to the text in the input the results will refresh. It is just the initial click back to the input field which shows the old results that I am concerned with.

Original search
enter image description here

Switch to New Zealand
enter image description here

Delete the "w" so the results refresh
enter image description here

joshhunt
  • 5,197
  • 4
  • 37
  • 60
  • Why don't you empty the autocomplete field when you change the country? – MrUpsidown Aug 14 '14 at 15:56
  • I think that's probably what I will end up doing if there is no other way to clear the results, though it does make it a bit less user friendly. For example if a user types in a city, realizes that they have the wrong country selected and change the country, they would then have to retype the city. Not a big deal, I just like getting the little things right where possible. – joshhunt Aug 14 '14 at 20:11
  • 1
    I am not a UX but I'd put the country selector on the left and the search field on the right. That would maybe help users realize they have to select a country first. Maybe you can ask http://ux.stackexchange.com/ – MrUpsidown Aug 15 '14 at 13:02

1 Answers1

0

I had a similar problem and I simply used:

$("#autocompleteId").val('');   // using jQuery

Refer to similar problem

Community
  • 1
  • 1
paulo62
  • 2,637
  • 1
  • 21
  • 15