Let's say I have the following single level vocabulary:

Parent A
- Child A1
- Child A2
- Child A3
Parent B
- Child B1
- Child B2
- Child B3

where the parent tags serve to "organize" the child tags into categories.

Is there any way I can require a node be tagged with a child tag (i.e. disallow selection of the parent tag)? This would be perfect as it'd require the node to have a specific tag associated with it, but still allow users to view all nodes tagged with children that fall under a parent tag.

Comments

Rowanw’s picture

Tags refer to "free tagging" which is meant to allow people to write whatever tags they want with no restrictions. What you've posted is a controlled vocabulary.

If you want to make people only choose a child term then you probably need to set up two vocabularies and call them, for example, Parent A and Parent B, then the child terms become the top level terms in that vocabulary.

Example of multiple vocabularies:
- Type of product
- Manufacturer
- Brand

djorn’s picture

Hmm. Thanks for the advice. The problem with this is that the vocabularies should be mutually exclusive (i.e. if you label a node with a term from parent A, then the node should not be labeled with a term from parent B). I'm probably taking the wrong approach to my problem. I'm going to step back and discuss this with the team a bit and see if there is a better approach. Thanks!

djorn’s picture

I saw two places on Drupal.org where they do something similar to what I have in mind.

First is the forum page where you select a forum for your topic to go under (http://drupal.org/node/add/forum/0). If you attempt to choose one of the container tags, you get an error message upon submission.

Second is the project drop-down menu (http://drupal.org/project/issues/drupal) where you cannot select the parent categories, only the children. I took a look at the HTML, and it seems very trivial to implement.

I believe both examples require a custom module. I personally prefer the second method and was thinking it'd be nice to add this type of widget as an option to taxonomy for single-level vocabulary. I'll probably try to take this approach.

Rowanw’s picture

You're most likely correct about writing a custom module, but first check this list: http://drupal.org/project/Modules/category/71

Stomper’s picture

Hi,

I am having similar issues. I am using custom vocabularies using parent and child terms (running 6.19). I would like to the parent terms to be used only for organization and that the users can only select a child term as an option, not a parent.

- Sports (parent)
- - Golf (child)
- - Soccer (child)
- - Jiu Jitsu (child)

I'd only like the user to be able to select either Golf, Soccer or Jiu Jitsu - not "Sports." I'd appreciate still being able to display the parent term above the child terms though.

Any tips?

Stomper’s picture

Thanks for the module recommendation. I will look into it further.