We need dynamic/dependent dropdowns especially on our Profile/Sign Up and Taxonomy sections of the site.

We are willing to pay well someone to create a strong and seamless integration of this functionality. We require it mainly for location (country > state > town) but maybe for one or two other things too.

Comments

nancydru’s picture

DHTML Menu module

Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes

bcn’s picture

esllou’s picture

yes, it's actually dropdowns to get data into the DB that we require, not menu dropdowns. Sorry if I wasn't clear on that.

We have actually tried both of the mentioned modules. ActiveSelect seems to be something that doesn't do anything on its own and is only needed by other modules. DependantDropdown has caused us many a sleepless night in the last week or two, hence our decision to post on this Paid Work forum. There is zero documentation and I presume people are supposed to just guess how it works.

noahb, mail me if you know how to use DD well and can provide a walk-through to its successful implementation.

laryn’s picture

I need the same thing you are looking for -- did you find anything that works?

krunar’s picture

hi there,

If i understand correctly you are looking for something similar with this .
If this is the case i might can help you, if you haven't solve the problem yet.

msn: evlassis@hotmail.com

esllou’s picture

How did you get those working? ActiveSelect?

We would be looking at loading data from a db.

mparikh’s picture

likely category + as

There is no need to pay anyone. look at http://drupal.org/node/74747

esllou’s picture

I've been following that thread from the beginning and was one of the reasons I started this one. i.e. it's very buggy and no-one seems to have got dep.drops working well on 5.1

mparikh’s picture

Hmm... It wasn't buggy on d5.1 for me. In fact, I have seen it working at three level depths. It is really cool to see it work... Are you using Form APIs with cat+as? There are a couple of issues with some hooks; but again eminently fixable.

Now cat has other outwordly effects (such as mysteriously disappearing forums and books) that are fixable.; but that is a subject for another node.day.

btw: you might want to PM nehalmehta. He has this working and can show how this works in d5.1.

wim leers’s picture

I experienced the disappearing forums bug, which is why I hoped there was a solution that did not require category.module. Could you please give me the link to that site whre you can see it work? I still have to see it in action... PM me if necessary. Thanks!

BenK’s picture

Because the Category module has its own set of problems/issues, I'm looking for a solution that doesn't require use of the Category module.

baal32’s picture

Category seems to come with a little too much overhead ATM so I'm looking for a non-category dependent solution as well.

wim leers’s picture

You may want to take a look at this: http://www.ubercart.org/jquery_dynamic_form/18. It essentially achieves the same, only you'll have to code every dependency yourself and you'll have to learn JQuery if you don't know that yet.

EDIT: fixed link

krunar’s picture

sorry for the late reply...
yes its as + category.
i havent play with db....i might give it a try when i finish with the site im working

esllou’s picture

the problem is, the type of job I'm talking about is using 200 countries, 5000 states/provinces and 100000 towns/cities in a CCK-made nodeprofile.

If anyone feels up to that, let me know!

using taxonomy and entering things one at a time is a total non-starter for this project. It must be db-based.

wim leers’s picture

With that kind of huge taxonomies, you'd better be using memcached I think... or you might get a very slow site.

davemybes’s picture

You should be able to use the ubercart code and add in a new function to extract the relevant countries/cities/etc from the database and put them in an array. Then use that array as the value for the select #options.

______________________________________________________________________________________________________
Need help? Check the FAQ and the Handbooks first.

______________________________________________________________________________________________________

krunar’s picture

if what you are asking is like the example i gave you with the only difference in the source (db instead of taxonomy) then yes i think it can be done...

just let me know if you want me to look at it
msn: evlassis@hotmail.com
mail: krunar@gmail.com

mparikh’s picture

This is really perking my interest. This is a very good use case for cat+as. Is using perl to get the data into the system an accepable solution? I am going to try this tonight. I am going to use the following format for data...

country1
country2
country1|state1
country1|state2
country1|state1|city1
country1|state1|city2

What is the max spread? how many max states per country ? how many max cities per state?

esllou’s picture

max states per country will be perhaps 100, average of 30
max cities per state might be 500, average of 100

If there's any heavy lifting you want me to do, I can.

mparikh’s picture

not bad. All that it takes is Gordon Biersch and some quality time...

I have it working for your use cases... can load about 200 cities in 30 seconds. You should be able to load 100,000 cities+ states in approx 4 hours.

It is very cool; and demonstrates the power of AJAX.

I don't really understand how a user is expected to choose from 500 cities (i have meaningless names such as city10089); however I am guessing that you would want to have user enter the first letter.

esllou’s picture

how do you mean four hours to load? load a page??? load a db??

If you could post the URL so I could play around with what you're doing, I'll let you know whether it's close to what I envisaged.

Ideally the person:

1. Would choose country from dropdown
2. Would choose state from that country's states
either 3a. Would choose town from that state's towns
or 3b. For the large states (California, Texas), would choose a alphabetical range (A-G, H-P, Q-Z) before town dropdowns appear.

as I say the towns-in-states average is probably 100 which is fine in a dropdown.

Are these coming from a db or is everything being loaded onto a page every time?

mparikh’s picture

The loading of the database will take approx four hour.

The use case is exactly as you have articulated.

The User Interaction Time is following :
Page Load Time : 3 seconds
Country to State Selection -- 1 second
State to City -- 1 second for 50 cities
-- 2 seconds for 100 cities
-- 3 seconds for 200 cities

The only reason that I took this up is because it is a very clear demonstration of AJAX. You don't need all the data on the page; load it on demand.

esllou’s picture

I don't understand why it would take four hours to upload what is, after all, just a text list to a db. I uploaded a list of 32000 cities into a mysql table last week and it was a matter of seconds. What is taking four hours??

If you have tables set up such as drupal_countries, drupal_states and drupal_cities, filling those with pure text is a very quick job.

As I say, if you want to post a link where you have this working (or send it to me via contact form if you don't want to post it here), I can see how close this is to what we envisage.

mparikh’s picture

I suppose my perl script could be opmitized to load it faster... but that was not really my intent. My intent was to see whether the dynamic dropdowns would work at all with that quatum of data and whether one could automate the initial data load. It does (work) and it can be (automated) !

Additionally my solution is very generic and does not load data into specific tables such as drupal_countries, drupal_states / drupal cities. This would limit it to very specific use cases. Instead the solution works even with four levels of hiearchy or two or three (as in your case). I will contact you through the contact form.

nehalmehta’s picture

Hi,

I have tried to show that dependent menu works fine with heavy db... Have a look at it... Voice quality in end is bit distorted due to my recorder's compression issues... Anyways this is just to show that we can have number of countries, states and cities dependent on each other...Number can go wild but with some scripting we can do that in some minutes only....
look at this video to see time delay..

http://www.youtube.com/watch?v=XrL89KRFB3Y

Nehal Mehta.

pushkar’s picture

Would be a great help if you can share the code, modules used and the process. I am looking to create a similar setup (state / city / district) and would help to get this working.

THanks

pushkar’s picture

http://pushkar.chipin.com/drupal-dependent-dropdown-module

This part is copied from the post here: http://drupal.org/node/134630#comment-219843

This is to get the bounty rolling for the first person who solves the problems and makes the module work for drupal 5.1 and drupal 4.7 AND RELEASES THE CODE FOR EVERYONE.

nehalmehta’s picture

Thanks to the generosity of an unnamed user, we will be able to release the complete video on the installation, configuration and mass data upload of our implementation of dependent dropdowns in the next couple of days. Watch this space! This will work with Drupal 5.1 and NO BOUNTY is required.

Nehal Mehta

pushkar’s picture

Dear unnamed user,

Thanks for pitching in.

Nehal,

Would be great if you can also release the codebase too. Videos are great to follow but would help to play with somethign working.

Is this based on the dependentdropdown codebase or this is something of your own?

Thanks again

grah’s picture

Thank you.

esllou’s picture

when will you be posting this?

uniterre’s picture

Hi,

Does someone achieve this ?

http://www.uniterre.com

geoff_eagles’s picture

If you're interested I've prepared a REALLY simple demo module which has 4 levels of linked dropdowns reading from the database. I based it on a location select because that seems to be what many people are interested in. Hope this is of help:

www.keyreels.com/drupal/locations.html

It uses Activeselect so you need to load that before you can run my demo. I've included some sample data.

Geoff

You can email me at geoff.eagles@gmail.com if you have comments

esllou’s picture

I would like to take this opportunity to thank Geoff here on the drupal.org forum for his efforts on dependent dropdowns.

Unfortunately, Geoff himself is not available for development work. The code he has posted a link to works well (there was a minor sql error but Geoff has told me this will get fixed this evening) but now I need a way of using this with CCK/nodeprofile.

What I have now is basically a static page. What can I use it for? I need to tag each member with a location. If anyone can give some tips about bringing Geoff's code outside its current static format and into CCK (perhaps via php snippets similar to block snippets), I would be both appreciative and willing to make a payment.

Here's hoping....

hintbw’s picture

Subscribing

Rob T’s picture

I've been interested in this type of functionality for a while.

Jürgen Depicker’s picture

subscribing

wim leers’s picture

See this comment of mine at another thread. If you'd like to test this, contact me.

joshua_cohen’s picture

Bookmark

chlobe’s picture

subscribing

toma’s picture

Subscribing

Rain-1’s picture

bookmark

markfoodyburton’s picture

I have faced the same, or similar problems as those listed on this page, so far in two ways. I agree that it would be nice to have an all singing, all dancing drop-down thing, but I fail to see how it's going to be easy to use, so I have constructed a couple of modules that solve my problems, and I suspect they may help other people. They may at least be a good place to start.

The two problems I have faced are these:

1. Having a number of products, each product is a cck node, each tagged with a term from a vocabulary. I wanted a CCK field that I could use to point to one of the products, but I want a "pre-selector" so that I can select what sort of product, then I want to select the actual product from a (hopefully much reduced) list.

2. In France, the post codes cover a number of towns, I want to type in the post code, and get a list of the towns. In this case, the database is quite large!

So, to solve these problems, I've built Taxonomy Search Module, and the Fixed Data Dropdown module.

I hope you all find them helpful, and feel free to send me your $'s if you feel morally obliged to do so!

(I'm cross posting this on node 124596, 134630 and 142589 as the same issues seem to be raised)

sheeraznafees’s picture

Hi All,

I am Sheeraz Nafees new on this site.
Did you try Ajax with php to resolved this, If you want I will do this.....

Sheeraz NafeesUddin

mrgoltra’s picture

Really interested where this leads.

bidossessi’s picture

i've delayed using drupal until now because i need this functionality.
would be glad to see a drupal module with dependant dropdowns in action

aconi’s picture

We also need to have something like that for our Travel-Site (planing to switch to Drupal). If it makes the process faster we are able to pay something for that!!

atelier’s picture

subscribe

droople’s picture

subscribed

mooffie’s picture

A while ago I wrote a tutorial in response to Neil's question. He paid me the $150 bounty. Note that on that page I've listed some alternatives to my solution. If you know of any other, let me know and I'll add them to that list.

PRFB’s picture

Thank you for coming up with a solution AND documenting it thoroughly.

jonahan’s picture

Fantastic work, moofie!

curtisc@drupal.org’s picture

This is the best solution I've seen thus far as it actually uses CCK and allows you to use the data with Views, which some of the other solutions lacked. I only wish there was some way that it could be done without requiring building your own database table and coding PHP lookups for the values, as some Drupal users might not know how to do that, but it works perfectly for my needs.

TC44’s picture

HI Moofie,

Great tutorial. I was able to get things working as per the tutorial, but was not able to get it working at all with views. Can anyone here point me in the right direction? I've spent the last three days testing various methods, and I find Moofie's to be the most stable and best for my needs, except for the views issues I am having. Without this I am back to square one.

In a custom view, I can get the country field to display options as an exposed filter, but not state or city. The country view filter also does not return any results.

Cheers,

TC44

mooffie’s picture

Thanks.

If you use the code I provided, Views will treat the country/state/city fields just like any other text fields. I've just added a little section to the end of "Part 9" with links to two Views examples. Nothing fancy.

I can get the country field to display options as an exposed filter

So you want to have this AJAX as an exposed Views filter too. Well, that's not a grave sin ;-) It's not something I wished to do in that article, so you're on your own here --my resources are limited.

[...] the country field to [...]

There's a great deal of interest in geo locations. I believe there should be a good Location module to handle all this. I'm surprised this isn't the case yet.

TC44’s picture

Excellent, thank you for the response and taking the extra time to post the examples. That clears things up for me. I think that both views alternatives you provide will get me there.

Thanks again!

toma’s picture

nancydru’s picture

esllou’s picture

two problems I see with this module:

1. Everything gets pre-loaded in a page. If you have 10,000 towns in a location taxonomy, that's going to hurt. If you have 100k (as I have), your site will grind to a halt.

2. You need to create these terms from within Taxonomy...ie. one at a time. If you have any more than a hundred or so of any taxonomy type, that will hurt as much as number 1.

wim leers’s picture

See my reply at the other location where you posted the exact same comment. Please continue there! http://drupal.org/node/142589#comment-276968

kibblewhite’s picture

How about this: http://drupal.org/node/196751

It will resolve your first issue, but not the second, you'd still have to enter the records manually or make an automation tool (which I'll do early next year as I'm working on a project that requires it)

I have a working example on a development site (so it's not going to be there forever) but I'll get you the URL if you want (via pm).

cgjohnson’s picture

Just wanted to second the stuff above. The hierarchical_select is great, but doesn't seem to allow the selection of mutliple terms, as best I can tell. If you don't need that, it's a fantastic module and I've found it very easy to use.

If u do need multiple terms and free tagging, Moofie's tutuorial on dependent dropdowns in CCK is a big help!
Again, it's at - http://blue.live4all.co.il/~mooffie/cms/node/15

thanks all.

cgjohnson’s picture

Hierarchical_select now allows multiple terms, FYI. It's in the newest release.

francewhoa’s picture

The new module Hierarchical Select will have two new major features:

  1. AJAX capable. That will increase speed for large scale projects. Such as thousands+ items (Taxonomy) in dropdown menus.
  2. Graceful degradation. That means working with both JavaScript deactivated or activated.

I’m sponsoring a small part of Hierarchical Select development. If others want to do a joint sponsorship your welcome. Beta testers are welcome too. Development updates are posted by Wim at: http://drupal.org/node/226067 Wim can be contacted at: http://drupal.org/user/99777 or work@wimleers.com

Loving back your Drupal community result in multiple benefits for you  
nancydru’s picture

I'm a bit confused. That module already exists. Are you saying it is undergoing major a rewrite?

francewhoa’s picture

Loving back your Drupal community result in multiple benefits for you  
g089h515r806’s picture

I have experiences to solve this problem.

there are 3 approachs:
1,technology: Javascript,Drupal form api.

when you select a country ,refresh the page and load the form again,then we get the state option from database,
when you select a state, efresh the page and load the form again,then get the town option from database.
this way is unfriendly with common user, but it's an approach to solve this problem.

2,technology: Ajax,jQuery,Drupal form api.
first, preloading all the country ,state ,town, and hide the state ,town option.
when user select a country , retrieve the specific states from database and fill up the state option,etc.

disadvantage: need preload a lot of data.
advantage:friendly with common user, it is safe that can prevent potential attack.

3,technology: Ajax,jQuery,Drupal form api.
we do not need to preload all the data from the database. Instead, set #DANGEROUS_SKIP_CHECK to TRUE in your form element,
then the program will bypass some of the form element's validation.
the rest of this approach is the same with 2 approach.

disadvantage: it is not safe.
advantage:friendly with common user, do not need to preload all the data from database.

I think the third approach can meet your requirement, if you do not care the security leakage.

Chinese drupal tutorials Think in Drupal

g089h515r806’s picture

you can contact me. i have many experience with Drupal, and build many drupal projects for our customer.

my email:g089h515r806@hotmail.com
skype:g089h515r806

Chinese drupal tutorials Think in Drupal

durum’s picture

in case..