I would like to create dynamic select lists. For instance, my page may have two select lists on it, lets use an analogy from the auto industry.

First select box:

Chevrolet
Dodge
Ford
Toyota

Select select box would be populated based on first;

Chevrolet -> Cobalt
Chevrolet -> Silverado 1500
Dodge -> Ram 1500
Dodge -> Ram 2500
Dodge -> Avenger
Ford -> Mustang
Ford -> F150
Ford -> F250
Toyota -> Celica
Toyota -> Avalon
Toyota -> Camry
Toyota -> Tundra

If someone chooses Toyota in the first box, they would be given a list of the vehicles in the second box. So, it would be Make -> Model. I think this would need to go further than just 2 dynamic boxes though. Someone may want Year -> Make -> Model -> Trim Level. I would love to see this type of feature, or if there is currently a way to accomplish this, please let me know.

I actually have a project that requires this type of functionality, but it is more for choose schools (high school or college). One set would be for high school and the other set for college. It would be State -> City -> School.

Thanks,
Shane

Comments

quicksketch’s picture

Title: Create Dynamic Select Lists » Hierarchical Select Lists
Version: 5.x-2.3 »

What you've described here is a very difficult problem and it is not yet supported in Webform. Moving to the 3.x branch where any new features would be added. This feature will never be in the Drupal 5 version of Webform.

quicksketch’s picture

Version: » 6.x-3.x-dev
Victor Safronov’s picture

This feature could be very useful.
And the hierarchical_select module has comprehensive API, so I suppose it's not a big trouble.

quicksketch’s picture

The biggest problem with this request is figuring out how to support hierarchies in a way that's easily configurable. Right now Webform has support for a single level of hierarchy through Optgroups. Providing more than one level could require us to re-architect a few things. If we did support hierarchies, we'd definitely end up using Hierarchical Select module for the display of such options.

Alexander Matveev’s picture

Subscribing.

404’s picture

subscribing

drupov’s picture

Subscribe

webankit’s picture

sub

henneman’s picture

Subscribe

flamingvan’s picture

Quicksketch, regarding your post #4, I have been thinking about this a lot. I have a client who's interested in this feature and I've been working on writing up an estimate (not an easy one).
Regarding the interface, wouldn't Drupal's existing drag and drop feature be a nice way to do it? So for example you drag one select box under another (and over a bit) and that indicates the hierarchy? Forgive me if this is an obvious solution.
My potential client needs, in some cases, hierarchies in which a parent select has multiple children, meaning that a selection of one box changes multiple other selection boxes.
I've been considering a couple different ways of handling this project, including writing a new webform component from scratch, or just using optgroups in the existing select component and then using Jquery to create the dependencies.
Any opionion on what the best way to go about it is?
Thanks

flamingvan’s picture

I am getting pretty close to a solution and it is very different from what I wrote above. I'm planning to use the hierarchical select API and write a custom component. Here's an idea for how a user would enter data for the tiered lists, in which the columns represent parent, label, value:

root | food | food
root| beverage | beverage
food | hot | hot
food |cold |cold
hot | pasta | pasta
cold | sandwich |sandwich
beverage | soda | soda
beverage | juice | juice
juice | orange |orange
etc.

I think that should work well enough, right?

quicksketch, I love your webform module from the user side, but it is also SO GREAT from the developer perspective! I have taken advantage of the hooks for a couple of projects.

quicksketch’s picture

@flamingvan: That looks like a good approach though not exactly and easy-to-write format, but hey, hierarchical lists are pretty hard. Even when you finish, I don't think we'll be able to include this directly in the Webform project, but I would love if I could reference it as another project (even just a sandbox) on drupal.org.

flamingvan’s picture

Assuming the project goes through I will absolutely put it up on drupal.org. I submitted a proposal for the project on Friday so we will see what happens. I will keep you posted.

flamingvan’s picture

I don't think I'm going to get the job :(

If anyone is interested in this I have an estimate all written up.

ayalsule’s picture

sub

bastiaan1321’s picture

sub

camilo.mejia’s picture

@flamingvan: I'm interested in continue your work. I have a client that need it. Please help me with any aditional info or progress that you have and I will try to make a module to solve this problem. Thanks.

flamingvan’s picture

Hi Camilo,
Never really went anywhere with this. The client hired me to do some other work but not this jobs. See my post #11 above. I think that's the way to go.

quicksketch’s picture

Status: Active » Postponed (maintainer needs more info)

Marking this postponed, since I have no plans for direct Hierarchical Select list support in Webform. As said above a few times, this can be implemented as a separate module using Webform's hooks (hook_webform_component_info()). Even if it were implemented, it wouldn't be part of the main module.

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Postponed
than1337’s picture

Version: 6.x-3.x-dev » 7.x-3.9
Assigned: Unassigned » than1337

Sorry if it's not the right place to ask my question. I'm new on Drupal.

I'm working on a module which will add a dependent dropdown in a webform element based on a select list which is actually populated by the hook_select_options_info .
Anyway, I have problems to make the thing work, I've tried with ahah and ajax API. Does anyone have a simple solution to make this kind of seelect list working?

I think if I have no solution until the end of the week I'll try to make it the traditional ajax/js way.

Thanks.

shanefjordan’s picture

than1337 - take a look at the webform conditional module. It may help, depending on how complex of a solution you are needing.

You could create multiple select lists, then based on the main list option selected, display one of the other lists you have created.

Good luck,
Shane

than1337’s picture

Thanks, I'm working on it right now, it's juste what I was looking for. :)

I'm trying to figure out how how webform conditional is getting the first select list value. So I can make a dynamic option list on the same trigger, like hierarchical select would do.

Thanks again.

danchadwick’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)

These requests are for the -3.x branches, which won't receive futher development. While I see the desire for this, the lack of good support in core is a problem. I don't see this being added. Most users are using conditionals as suggested above.