By Fincher on
Hello,
I try to create simple web form with hierarchical select. First is the select list with countries. When I choose e.g. "France", second list should offer me a list of French cities with options like "Paris, Marseille etc."
I installed the HS module and created taxonomy vocabulary with a list of countries. That´s it, don´t know what to do next and how to make it work. Thanks a lot for help.
Comments
Add cities as children...
I think the next step you'd take is to add cities as child terms of each country.
But to add all cities for all countries... that's a lot of work, so it might be easiest to create the hierarchy in a spreadsheet format and import using something like Taxonomy CSV when you have the full structure, otherwise editing a huge, multi-level taxonomy tree can be cumbersome.
Hope that helps.
See you at the Drupalcon!
Thanks for reply. Sorry for
Thanks for reply. Sorry for stupid questions, but as I am pretty new to Drupal, how can I create child terms of each country? Let´s say I want to add child terms "Paris" and "Marseille" to parent "France". Many thanks.
Multiple ways...
But essentially you create a new term (with any method) and when creating it, set its parent term to be "France"... or edit a term and set it's parent to "Greece" ... or whatever. Then you can add child terms to those, if need be, e.g. to create a Country -> State -> City structure, perhaps.
Anyway...
The Taxonomy manager module can be helpful when doing a lot of work with terms.
http://drupal.org/project/taxonomy_manager
And, again, if you can get it to work for your needs, the Taxonomy CSV module might be the simplest way to get the full structure of your locations into the system without a lot of online editing. The other nice thing is that you would still have your file, if you need to do it again. Unfortunately, it's not very well documented and is a bit buggy:
http://drupal.org/project/taxonomy_csv
Hope that helps.
See you at the Drupalcon!
Thanks!
Thanks, man, great advice! I created a sample form with a couple of terms for countries and a couple of child terms for cities. It seems to work nice, just one thing: everytime I select an option in the hierarchical select, I get this alert: "An illegal choice has been detected. Please contact the site administrator."
Could this be connected with the default option settings in the select lists? I am using localhost.
I don't know what is causing your error.
But this is an error from the "core" Form module and I've seen it before, especially when testing inserting illegal values into a form submission. Either of these two is likely:
1) Somehow you are selecting elements which don't make sense to the validation system, so maybe check everything carefully.
OR
2) There might be a bug with that module or another which is producing this result.
I'm pretty sure that running on Localhost has nothing to do with this, but default options might be involved.
Best of luck. :-)
See you at the Drupalcon!
Default option in select lists
Thanks for your help, man. Just one more small thing:
- in the first select list I have a default option "" (it is possible to adjust it in the content type settings, in my case "article" settings)
- in the second select list there is no default option, just a "blank line" (didn´t find any way to set the default option to "" or "
",..)
How could I accomplish to set the default option also for the second select list? Many thanks.
There should be "none" or
There should be "none" or "select one" in parentheses above.
You did it with webform
You did it with webform component or editing the webform content type?