Dynamic selectbox in Drupal

Submitted by DenRaf on Tue, 05/27/2008 - 19:40

Anonymous (not verified)

Wed, 05/28/2008 - 00:04

are you going to share or contribute to drupal.org your modified module? ;-)

Anonymous (not verified)

Wed, 05/28/2008 - 00:05

took me 7 tries, and then it sent it to submission

oh, and here's another captcha

Anonymous (not verified)

Wed, 05/28/2008 - 19:24

Why was HS "just not the way to go"?

P.S.: this is Wim Leers, the maintainer of the Hierarchical Select module. You may want to disable the "allow anonymous comments only" option. ;) :)

Anonymous (not verified)

Fri, 05/30/2008 - 12:31

I'd be interested also in why Hierarchical select was just not the way to go ... HS seems like it would fit the bill perfectly.

For a subscribing form I need a dynamic selectbox, which was reloaded when a first selectbox was changed.

I tried activeselect, which worked in my testing environment, but not on the actual site which had a hook_regions (bug: http://drupal.org/node/125451).

Hierarchical select was just not the way to go in case of this site. It required the use of vocabularies, while I was working with database content directly. And so many other solutions I tried, but without the wished result. After some searching I found this: http://f5sitedesign.com/drupalcamp.
After modifying the module, I finally had it working.

Attached you can find a simple module. As you can see in the code it requires the location module and some content in the db. I'll see if I can provide some data for in the location db.

It provides a lillte module for subscriptions. In this case it's for selecting a province which will load the second selectbox with offices in that province. It's not the best example. because for this you can use HS, but atleast you get an idea.

The module provided at the drupalcamp site shows an example with replacing text in a div and the principal for this is just the same. So you can replace anything you want as long as you have an id to hook in to.