strange that I did a search on here for "field" and there were no matching issues...

I'd like to create a field where values have a parent-child relationship to each other. Specifically, I want to create a "classified ad" content type where the location field looks something like - country>state>city with each one being a dropdown with parent-child relationships so that the "country" value determines what values should be populated in "state".

Is this doable in CCK? Any solutions?

Comments

yched’s picture

The Activeselect module provides exactly the functionnality you need (a dropdown that triggers updates in the values of another drop-down)

But... the cck generated drop-downs are not aware of this, you'll have to code a bit...
I'd say develop a small module that will implement the hook_form_alter hook, in order to have the relevant cck-genereted select widgets use the activeselect function.

Might require a bit of trial and error, but undoubtedly doable :-)

sodani’s picture

Oh gosh. I wish I knew how to do this.

karens’s picture

There's an outstanding request to add something like this to the location module, and ultimately to the location views module. (Actually, we were just going to link the state options to the selected country, no plans to do anything with city.) If no one else does it, I plan to try to work on it when I have time, but that's not going to be right away. If you can wait until then either you might be able to location-enable your nodes and use the location module for this purpose, or use that as a model for developing something for cck.

sodani’s picture

Thanks. The location module is certainly along the lines of what I'm looking for. However, I'm also trying to get non-location hierarchical tagging on my CCK nodes, where certain fields are dependent on others and it seems like it doesn't allow that.

For example, if you want your CCK nodes to be classified ads, and someone chooses "car", you would want to add other fields that are dependent on that, such as make, model, year, but not necessarily if they chose "painting".

coupet’s picture

Excellent feature to implement! status?

inforeto’s picture

CCK data can be used from any module, so perhaps this functionality belongs to views.
In any case, active select was made to create ajax select boxes, so perhaps this issue should be changed to "support active select directly in cck".

coupet’s picture

dependantDropdown
http://drupal.org/project/dependantDropdown

This modules adds a CCK type which defines a dropdown with a dependant value list upon the value of a different cck field

karens’s picture

The dependentdropdown module looks like it could be interesting, but the project was created a month ago and no code was ever added to the repository.

hedb’s picture

Title: field value lineage » I did load my code to the repository back then

I did load my code to the repository back then
I see now that i missed something,
maybe to create a first release? (how do i do that?)
i'll try to solve it.

karens’s picture

Title: I did load my code to the repository back then » Dependent fields

Changing title back

karens’s picture

Category: support » feature

Actually this is a feature request.

dopry’s picture

Status: Active » Closed (won't fix)

and not in 4.7.x... or ever. this kind of functionality is advanced and outside the scope desired for the CCK module. Do it in contrib if you want it.