This is what I want to do and i cannot figure it out, tried with CCK/nodereference, tried category module, transforming nodetypes etc but just cannot get my head round it:

i want users to create a node of type ORDER.
I want them to create entries like "white, neutered, siamese, cat", or "wild, shetland pony, horse"
(this is actually an analogy, my example is more industry specific so I chose animals as something everyone can relate to)

First I want to ask what animal: horse, cat, duck or whatever (on a seperate section each animal has its own page with picture, info etc. so it has to be a node in its own right)
Then I ask the breed. If he selected horse, the dropdown options are shetland pony, trotting horse etc.
If he selected cat the dropdown options are persian cat, siamese cat etc.
(I got this far :P, I actually just have one dropdown with the cat breeds as children of the cat, and horse breeds children of the horse etc. - that was easy).

Now it gets complicated here, I want to ask some more options depending on the ANIMAL (not breed).
e.g. if he selected horse, I want to know how ridable it is? (wild, semi-tamed, very tame)
if he selected cat, i want to know whether its neutered or not, and what color is it? white/grey/tabby etc.

So I think the first thing I need to do no matter what the solution is create nodetypes
Animal nodetype - Horse, cat, duck etc.
Breed nodetype(depends on animal): shetland pony, trotting horse, persian cat, siamese cat etc.
Option Category nodetype: (depends on Animal, NOT breed), ridability (horse), neutered or not (cat), color (cat)
Option nodetype (depends on option category): wild, semi-tame, very tame, neutered, not neutered, white, grey, tabby, black etc.

ATTEMPT 1,000,000,000:
The closest I got was using CCK with noderefernce field to link each node to its relevant parent. And so now I do have all of my data stored internally with the correct relationships and that works (e.g. white is a color option category of a cat. shetland is a breed of horse etc.)

But how do I get users to create entries like "white, neutered siamese cat" etc.! I thought I could use CCK with noderefernce to create the ORDER type, but I cant because the number of fields varies! (cats have 2 options, horses have 1) - besides the list needs to be filtered to show only those available to that animal. So somehow I think i may have to use the category module and just tag the ORDER with these.

ATTEMPT 1e27:
I scrapped the noderefernce fields and decided to use only the category module.
I created a container called Animals which tags nodetype ORDER.
I transformed the nodes Cat and Horse into categories and gave them as children to the Animals container.
Under both Cat, and Horse I created 2 child containers each, Options and Breeds. The former accepts no nodetypes, the latter tags ORDER nodetype.
I transformed each nodetype of Breed into a category and assigned their parents respectively.

I transformed each nodetype of Option Category into a container and assigned their parents respectively,
I transformed each nodetype of option into a category and assigned their parents respectivly.

Now finally the data is stored correctly internally. The only ugly thing is everytime I create a new animal, I need to create 2 child containers, Breed and options.

Now the tricky thing is, how do I get it to not display all of the categories! http://www.memo.tv/cms/node/add/story
First you should see just the Animal dropdown, and when you change the relevant dropdowns appear and dissappear. And the user must select an entry from each visible dropdown (if its a cat, he must answer all cat related questions).

Is this the way to approach this problem!? Any ideas welcome!!!

P.S. i posted a similar question here http://drupal.org/node/74651 but felt I had worded the question too inaccurately and confusingly so created this new post which is much clearer I think.

Comments

mwu’s picture

as far as i know active select is the closeest thing but I never got it working

high1memo’s picture

WELL!! im happy to say, i've got it a bit working!!! and yes active select is the answer together with the category module, distant parents, combined with flexinode or CCK and its amazing!! jeremy you are a genious!!!

you can see working example at http://www.memo.tv/cms/node/add/story (only first 2 dropdowns work at the moment - and prob by the time you look it will have changed!).

The best thing is, the solution is quite clean (i.e. no creating a breed container under each animal etc.)

I was going crazy to figure out how to do all this cos I couldnt find any tutorials so here is my quick step by step (I can post a slightly more detailed tutorial later, i dont have much time right now :P)
(This step-by-step is for STORY nodetypes, i.e. you get the dynamic dropdowns when creating a STORY. If you want to do it with another nodetype or more, just select those nodetypes where i mention STORY).

By the end of this what will happen is: when you goto create a STORY, you will be asked to CHOOSE ANIMAL and CHOOSE BREED. At the begining the CHOOSE BREED dropdown is empty. When you select an animal, the 2nd dropdown will populate with the breeds of that animal.

1. Upload the category and active select modules, then enable them in admin>>modules. No setup is nessecary, both modules can be used straight out of the box. (for this step by step i wont be using custom nodetypes, but just the standard categories and containers to keep it simple - I actually created nodetypes as i mentioned in my orig message and transformed them, but i dont wanna get too confusing)

2. Create a CHOOSE ANIMAL container:
- under CONTAINER INFORMATION / TYPES select STORY
- Set its PARENT as ROOT

3. Create a CHOOSE BREED container:
- under CONTAINER INFORMATION / TYPES select STORY
- Set its PARENT as ROOT
- Under DISTANT PARENTS select CHOOSE ANIMAL(this is the magic, more on this later).

4. Create a CAT category
- under CATEGORY INFORMATION, for its CONTAINER and PARENT select CHOOSE ANIMAL

5. Create a HORSE category
- under CATEGORY INFORMATION, for its CONTAINER and PARENT select CHOOSE ANIMAL

6. Create a PERSIAN category
- under CATEGORY INFORMATION for its CONTAINER select CHOOSE BREED
- wait a bit for the PARENT dropdown to update, then you will see you can choose CAT or HORSE. Select HORSE.

Create the other breeds in exactly the same way, selecting CHOOSE BREED for the container, and the appropiate animal for its PARENT. Basically by setting the CONTAINER of the category to CHOOSE BREED, we are telling drupal that node should appear in the CHOOSE BREED dropdown. But by setting its parent to CAT or HORSE, we are linking it to the right animal. ActiveSelect takes care of the rest. And the reason we can select CAT or HORSE as the parent of the new breedcategory because we selected CHOOSE ANIMAL in its distant parent properties. i.e. we said: Any category under the CHOOSE BREED container (e.g. persian, siamese, shetland, trotting) should be allowed to have a parent from any category under the CHOOSE ANIMAL container (e.g. cat, dog).

And its actually really simple!!!

But now where I am stuck, are the options. Mainly because there are a different number of options for each animal!! argh!!!! :S

I've cheated and hard coded 2 options per animal. So even if an animal doesnt have 2 options (e.g. horse) I display the dropdown, but its empty. Also I cant change the label of the dropdowns, so the actual categories have to be descriptive. E.g. I cant have a label which says 'neutured' and then a 'yes' or 'no'. Instead I have the standard label option1: and then 'neutered' or 'not'neutered'.
working version at: http://www.memo.tv/cms/node/add/story

drupalfan’s picture

Tell us what modules you used and how you defined the category stuff (which I found totally bewildering from the only "tutorial" available.) How do you display nodes/books once they are categorized? Thanks.

TBurg News

amitaibu’s picture

It helped me doing it!

tburton’s picture

Followed the instructions above in OMG post above but when I get to step 6 just cant get the the persian category to offer me the cat and horse options after i select breed as the container . Instead I get offered only breed as a parent. Any thoughts how I can get this working would be gratefully received

tburton’s picture

I was lucky enough to have a session with the category writer Jaza and all is working like a dream.

This is the summary of how to make it work based on the above OMG! I have some of it working post from high1memo, but slightly tweaked. The mistake I was making was in step 3 where I was selecting Animal* instead of just Animal

(This step-by-step is for STORY nodetypes, i.e. you get the dynamic dropdowns when creating a STORY. If you want to do it with another nodetype or more, just select those nodetypes where i mention STORY).

By the end of this what will happen is: when you goto create a STORY, you will be asked to CHOOSE ANIMAL and CHOOSE BREED. At the begining the CHOOSE BREED dropdown is empty. When you select an animal, the 2nd dropdown will populate with the breeds of that animal.

1. Upload the category and active select modules, then enable them in admin>>modules. No setup is nessecary, both modules can be used straight out of the box. (for this step by step i wont be using custom nodetypes, but just the standard categories and containers to keep it simple - I actually created nodetypes as i mentioned in my orig message and transformed them, but i dont wanna get too confusing)

2. Create a CHOOSE ANIMAL container:
- under CONTAINER INFORMATION / TYPES select STORY
- Set its PARENT as ROOT

3. Create a CHOOSE BREED container:
- under CONTAINER INFORMATION / TYPES select STORY
- Set its PARENT as ROOT
- Under DISTANT PARENTS select CHOOSE ANIMAL (not ANIMAL* in the drop down) .

4. Create a CAT category
- under CATEGORY INFORMATION, for its CONTAINER and PARENT select CHOOSE ANIMAL

5. Create a HORSE category
- under CATEGORY INFORMATION, for its CONTAINER and PARENT select CHOOSE ANIMAL

6. Create a PERSIAN category
- under CATEGORY INFORMATION for its CONTAINER select CHOOSE BREED
- wait a bit for the PARENT dropdown to update, then you will see you can choose CAT or HORSE. Select HORSE.

Create the other breeds in exactly the same way, selecting CHOOSE BREED for the container, and the appropiate animal for its PARENT. Basically by setting the CONTAINER of the category to CHOOSE BREED, we are telling drupal that node should appear in the CHOOSE BREED dropdown. But by setting its parent to CAT or HORSE, we are linking it to the right animal. ActiveSelect takes care of the rest. And the reason we can select CAT or HORSE as the parent of the new breedcategory because we selected CHOOSE ANIMAL in its distant parent properties. i.e. we said: Any category under the CHOOSE BREED container (e.g. persian, siamese, shetland, trotting) should be allowed to have a parent from any category under the CHOOSE ANIMAL container (e.g. cat, dog).

This approach will of course work for what ever taxonomy/structure you are seeking . Many thanks for those who helped.

DayShallCome’s picture

First of all, thanks so much for your help. You saved me many hours of trial and error.

But now I'm having a problem. I've done what you said (even made an exact copy of what you said). I added child categories to Horse (let's say shetland). But when I try to add a child to shetland, it puts it as a child of Horse. How do I get around this? I only want the first level to be an Active Select, and then have the second drop down menu display the entire rest of the list.

Any ideas?

Thanks.

Christoph C. Cemper’s picture

this is a funky thread - subscribing here :-)

ludwikg’s picture

me too :). Where is the add to favaourities button?

lias’s picture

this is very useful information. thanks for the step-by-step instructions!

duckpuppy’s picture

Similar to a problem I'll be tackling in a bit - good reference.

mbria’s picture

Thanks to post it. Same issue.

Rob T’s picture

Step 4 doesn't work for me. When I go to create the CAT category, nothing appears in the "parent" dropdown menu.

I've redone the prior 3 steps multiple times, yet nothing ever appears in the parent menu when I hit step 4. Just as frustrating is that I cannot create a category without a parent. How can I choose a parent when no parent appears to exist? This is on a fresh 5.1 install, btw.

Has anyone else gotten these steps to work perfectly for them?

macm’s picture

Me too. Step 4 have a problem in Drupal 5.1

Rob T’s picture

I'd thought about posting this as an issue on the category.module project page, but I fear it would get lost amongst the 47 pages of unresolved issues.

The module promises so much, yet fails to deliver on 2 important fronts: stability and compatibility.

rakish’s picture

I just spent 2 days off and on reading posts and tutorials. I could not get this to work, I tried lots of different things. I have found the following hack to work for me.

Turn OFF Active Select Module while you are defining your containers and categories. Define all the containers and categories that you are going to use. Then Turn Active Select Module back on and create your stories/nodes. Everything should work. The downside to this is that you need to turn off Active Select everytime you want to modify your category structure, this is obviously not ideal but it works for my purposes.

Thanks to everyone that has been posting on this to date

reggie75’s picture

The above steps worked fine for me. I am using version 4.7.

I have another question on how to get activeselect to work in views, but I guess I'll hvae to ask that elsewhere :)

justin_d’s picture

I tried above mentioned awesome steps using category-5.x-1.1.tar.gz.
But it gives error while choosing containers and parents [ container combo gets infinite searching :( ]
Firebug detected an error in activeselect.js right here..

if (text.length > maxWidth) {
147 maxWidth = text.length;
148 }

further i tried with category-5.x-1.0.tar.gz

cheers.

its working......

so might be developers of either activeselect or category amend appropriately.

armand0’s picture

This works for my

I made some changes in the file activeselect.js (some are published in these forums) and now it is working well.

These are the changes:

1)

      $(target).empty();
      var targetMatches = matches[matchesTarget]['options'];
      var maxWidth = 0;
+      var ind=0;
      for (currMatch in targetMatches) {
        var value = currMatch;
        var text = targetMatches[currMatch]['value'];

2)

        // display option text if the latter method is used (otherwise they seem
        // to behave the same).
-        $(this.targets[targetIndex]).append(new Option(text, value, false, selected));
+        this.targets[targetIndex].options[ind++]=new Option(text, value, false, selected);
        if (selected && !this.targets[targetIndex].multiple) {
          this.targets[targetIndex].selectedIndex = this.targets[targetIndex].options.length-1;
        }

3)

        }
        else if (document.createEventObject) {
          // IE special weird method
-          var e = document.createEventObject();
+          var e = document.createEventObject('Microsoft.XMLHTTP');
          e.bubbles = true;
          e.cancelable = false;
          this.targets[targetIndex].fireEvent('onchange', e);
        }
armanjava’s picture

I'm using the category module with activeselect in combination to the nodefamily, usernode and nodeprofile module to allow customization of the user profile(node) creation. How can I create a node(i.e. group) whenever a user selects a specific category within a container during the user profile(node) creation? I would want, say, anyone who chooses the category 'san francisco' within my 'cities' container to be automatically subscribed to the 'san francisco' group node.

Thanks so much for all your instructions above BTW... they saved me sooo much time!

Rob T’s picture

Not sure about the "automatically subscribed" bit, but have you looked into Organic Groups? You could create a San Fran group, and users would be able to join that group.

baal32’s picture

Running 5.1 with ActiveSelect and Category modules installed
I created a container: Classifieds Category with parent = - distant parents = this node
and container: Classifieds Subcategory with parent = - distant parents = Classifieds Category
Both have content type Classifieds (a CCK node type), single hierarchy

Created categories Rentals and Electronics, both with container and parent Classifieds Category
Created categories Apartments and Sublets, both with conatiner = Classifieds Subcategory and Parent = Rentals
Created category Game Systems with container = Classifieds Subcategory and Parent = Electronics

When I go to create a new Classified I see both drop down boxes but no matter which I choose for Classifieds Category I see the full list for Classifieds Subcategory (it doesn't change)

Any help would be greatly appreciated

nimbupani’s picture

I am running 4.7 and i have the same issue as baal32. Even though I do see both the drop down boxes and the parent drop down box (the CHOOSE ANIMAL) with the active select autocomplete animation, when i click on any item within the select box, I do not see a change in the corresponding CHOOSE BREED drop down box. Is there anything I am missing?

UPDATE:

I debugged this and found the issue in particular to be the defition of theme_regions() in template.php file in my theme which is causing this error. I wonder why is this function relevant to the activeselect?

fredy.raj’s picture

How did u solved the problem.Please help me

fredy.raj’s picture

How did u solved the problem.Please help me

liquidcms’s picture

sweet to finally find this post.. and i linked to it at Jaza's tutorial on this on his website (since this is the real tutorial).

Got it all set up and working very well except for the following issues:

1. activeselect breaks auto-parenting:

i use form_alter hook in a separate module to auto-parent the creating of a category (not sure why this doesn't work yet in the cat module - seems pretty obvious). But, since i do a form alter to actually remove all the options and leave only the one which i just said (in the URL) was the one i wanted as my parent activeselect will break this - since it re-creates the parent select list after i alter the form. I needed to hack cat.inc module to disable this for the admin form of creating cats.. while leaving it where i REALLY needed it which is when i want to tag new content.

2. activeselect breaks breadcrumbs.

My original architecture had single container with categories, sub-cats, sub-sub-cats, etc, So since each sub had its parent defined above.. breadcrumbs worked fine (of course UI of searching through 1000's of items when trying to tag something led me to activeselect). With active select you actually are tagging (I think) with each category along the way.. and so breadcrumb has no idea which path is real.. so it picks the top parent. So, in the example listed here - picking cat-persian to tag your pet with would give breadcrumb of simply HOME->Cat not HOME->Cat->Persian as it should.

Some code in my template file should be able to sort out the real path though. So not too busted.

Peter Lindstrom
LiquidCMS - Content Management Solution Experts

ouke’s picture

I have a container named "recipes" and child containers like "soups", "salads", etc.. and then I have categories under those child containers that corespond to them. when a user clicks "recipes" I have a link on that page "submit your recipe" that goes to a content type named "recipes" so that they can fill out the form, adding their recipe, and what i need it to do is ask what category their recipe goes in such as "soups", "salads" etc. the only thing it is showing is a category option called recipes but only is listed under it , and no other categories are listed for them to choose. im pulling my hair out with this one. I just need them to be able to pick the category but i think i may have this set up wrong. please help if you can. thank you.

Wim Leers’s picture

Very interesting discussion here, too bad it can't be done without the category module (i.e. with JUST taxonomy+activeselect+content_taxonomy (taxonomy CCK field)), which I actually don't need. If anybody could show me the direction I should go to do this without the category module, please contact me (even if you're reading this post when it's years old...).

Subscribing.

BenK’s picture

I, too, am interested in accomplishing this without having to use the Category module.

bcn’s picture

tracking...

litwol’s picture

subscribint

Sometimes something interesting appears on http://litwol.com

vanvemden’s picture

me too....

Jürgen Depicker’s picture

subscribing (4-7)

erikb’s picture

just saving it for later

mparikh’s picture

and has video also on this. Ensuring cross posting

http://drupal.org/node/124596

chlobe’s picture

may the force be with you in making this work

henigushi’s picture

Molto grazie!

momper’s picture

subscribe

mrgoltra’s picture

Good Day All,

I am somewhat new to Drupal and still looking for ways to implement country > state/region > city selection. Will active select work in such a way that when I select a country it will only list the state/region pertaining to that country and the city to that state/region selected?

How can I implement something like this?

TIA,

Mark

mrgoltra’s picture

Good Day All,

I am somewhat new to Drupal and still looking for ways to implement country > state/region > city selection. Will active select work in such a way that when I select a country it will only list the state/region pertaining to that country and the city to that state/region selected?

How can I implement something like this?

TIA,

Mark

mrgoltra’s picture

Good Day All,

I am somewhat new to Drupal and still looking for ways to implement country > state/region > city selection. Will active select work in such a way that when I select a country it will only list the state/region pertaining to that country and the city to that state/region selected?

How can I implement something like this?

TIA,

Mark

PRFB’s picture

Moofie's tutorial on this very subject. It ROCKS.

http://blue.live4all.co.il/~mooffie/cms/node/15

mrgoltra’s picture

... seems like a great tutorial.

mrgoltra’s picture

Hello PRFB,

Really appreciate the info. Looks very promising. A few questions if you don't mind?

Have you implemented this? Seems very easy to do especially for a noob like me. So from my understanding database has to be preset. Mooffie provided a sample, which is very limited. Where would you recommend a free database?

Thank you much.

Mark

armand0’s picture

It seems well. But like he mentions himself in the same tutorial, to define posts there are many options. What I find but important it is to SEARCH. As you it can use in the views (or another module) to define the search and to facilitate the search to the users (in what Drupal is terrible).

Using the data of the same tutorial, I will give the following example:

To search X nodes for a Country
For Country and State (and that they are only seen the states of that country, and the option All.).
For Country, State and City (and that they are only seen the cities of that state, and the option All.).

Can one make?

PRFB’s picture

I haven't done more than look at it with relief that it can be done (lots of other things on my to-do list first).

The data I'm dealing with has little to do with geography, but I know you can get all US cities with population over 100k from...
http://www.census.gov/popest/cities/tables/SUB-EST2006-01.csv
It also lists state and population, so you can set your own population cutoff.

As far as non-US data goes, the UN is probably your go-to source for free data. This looks like it should let you massage it into a good dataset: http://unstats.un.org/unsd/cdb/cdb_series_xrxx.asp?series_code=14720

Both of these sources are free to use and do with as you please. Our tax dollars at work. :-)

Good luck!

mr.andrey’s picture

Hello,

I have site where Events and Classified are categorized by location (Country -> State/Province -> City), so people can view results relevant to their area (a la Craigslist.org)

I have Category and Active Select module create the dropdown menus with the categories when I edit a node.

Then to display the Classified ads relevant to a particular location, I just go to the node of that category (ex. /united-states/california/berkeley), and I see all the classified listed below. Both input and output are very neat and consistent.

I would like to port the input into the Event calendar display/output, so when I see the calendar, I can choose Country, which will populate State/Province, which in turn will populate City - just like on the input.

Here (http://drupal.org/node/147437) someone attempted something similar, and killes pointed them to http://api.drupal.org/api/head/file/developer/topics/forms_api.html and to "use hook_form_alter to change event_taxonomy_filter_form".

In template.php I set up a function phptemplate_event_taxonomy_filter_form($curterm, $autosubmit), and it overrides the default drop-down menu, but I'm a bit at a loss about where to go from here.

I'm hoping to get some feedback on how to port the category input form to the event display output.

Any suggestions or ideas are very much appreciated.

I started a new thread about this here: http://drupal.org/node/160875, please post your ideas/suggestions there.

Thank you,
Andrey.

stephen.idealso’s picture

Hello,

I need almost the exact same thing as is listed here, but a bit more dynamic.

Here's what I need:

You have a Course.

The Course will include lots of information, including:

Format
Specialty
Location

etc ...

Now the Format needs to have a type of indicator as to whether or not a location is neccesary. Example, a Course with a Format of DVD Video doesn't have a geographic location, but a Course with a Format of Lecture does. So based on what is chosen for the Format, the Location section of the form needs to be available or not.

The Specialty is mentioned, though it has nothing to do with the Format/Location relationship, rather it's simply a taxonomy list to allow for tagging the courses.

Currently I have Course, Format, and Location setup as content types (node types) and Specialty as a Vocabulary list (Taxonomy list, Category list)

The tricky part, is that I want the Format, Specialty, and Location fields to either allow for selecting from a list, or adding an entirely new node / taxonomy term.

What I'm not sure of is how to do this functionally. I currently have the Node Reference CCK installed, and the Add Node module installed, so when I create a course, I can either select the format from a list or create a new one, and the same for location. but I have no relationship (and don't know how to create this relationship) so that if the Format chosen meets a yes/no condition the location is then allowed or not.

Any help on this would be great!

-S

 /================\
| Stephen Baker  |
|----------------|
| Ideal Solution |
|----------------|
| Software Dev.  |
 \================/
artha6’s picture

tracking

danthalian’s picture

tracking......

yeeloon’s picture

Hi all!

You see... I've managed to get it working as http://drupal.org/node/74747#comment-157813, but only when I was logging in as "admin" (userid = 1). I'm using Drupal 5.2, category-5.x-1.1, activeselect-5.x-1.0.

When I try to make permission changes over at Access control, somehow I don't know where the "Categories" is and it is definitely not found in Access control. When login as a normal authenticated user, I couldn't locate any Categories under the Story node. So, how can I allow an authenticated user to make a Story post with the shown Categories?

I would appreciate if someone could help out on this. Thanks!

SocialNicheGuru’s picture

subscribing

http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.

Igbonine’s picture

Gee.

siliconandincense’s picture

Sub