2

I am using Drupal 7 and conditional fields. I need to show a select field with values based on the value selected from the first option field. For example, if the first selected option is "Country" and I select "Country" to be India => I want to display all the states of India in the second field.

Boriana Ditcheva
  • 1,995
  • 15
  • 26
user1679530
  • 21
  • 1
  • 2

2 Answers2

2

In this exact situation I have used http://drupal.org/project/reference_option_limit Limiting the name of the cities by country.

Here is how you can configure. http://drupal.org/node/1596310

1

This should be exactly what you need: http://drupal.org/project/hierarchical_select

Let us know if it works!

Boriana Ditcheva
  • 1,995
  • 15
  • 26
  • Isn't [Address Field](http://drupal.org/project/addressfield) or any other location-based modules better for this task? As far as I know, Hierarchical Select lets you use e.g. a Taxonomy vocabulary hierarchy easily, but I think it would be a bit strange to keep countries and states in the same vocab. Don't you think so? Or do you know any opportunities to keep these terms in different vocabs, but let the user select them on e.g. a node creation form similarly? BTW, what if someone wants to display the country and the city data separately, like if they were separate fields? – Sk8erPeter Sep 26 '12 at 19:00
  • You know what? I think you have a very valid point about the fact that it's a country and states and the fact that there are modules that handle that type of information specifically! I was so focused on the title of the question and the concept of a second field appearing based on the selection of a first that I only addressed that aspect of it. I've used hierarchical_select module successfully and it works for that quite well. But I am totally with you that there may be other solutions that fit geographical information better. Feel free to add anything else to this! :-) – Boriana Ditcheva Sep 26 '12 at 23:48