0
votes

I am trying to create a search function where there are 3 select boxes ( tags) which are a) Country b) Region c) City. When you select a country (e.g. Australia), the region select box will be filled with regions from Australia. (e.g. Queensland, Tasmania, and etc.)

I have found a library called Select2 (http://ivaynberg.github.io/select2/) where it is easier to search and select a value compare to the traditional .

But my problem is that I need to allow user to search like the following examples:

Scenario 1: Select multiple countries. e.g. Australia, USA, Brazil, Singapore

Scenario 2: Select multiple countries, regions e.g. USA, Brazil, Singapore, Queensland (Australia), Victoria (Australia) (When you have selected a region, you can ignore the country value)

Scenario 3: Select multiple countries, regions, and cities e.g. Brazil, Singapore, Queensland (Australia), Victoria (Australia), New York City (USA), Washington (USA) (When you have selected a region, you can ignore the country value, when you have selected a city, you can ignore the region and country value)

Not sure scenario 2, 3 make any sense? In other words, when you have selected a city or region you don't need to pass the country or region value back to server.

I am hoping not to spend too much time to reinvent the wheel here, so hopefully there are already a library/script (e.g. Select2) where it can handle the scenarios like above?

1

1 Answers

0
votes

you could use chosen

I hope this can help you

Juanitos