3

I have a vocabulary displayed as checklist that has both parent and child terms like:

  • Parent 1
    • Child1.1
    • Child1.2
  • Parent 2
    • Child2.1
    • Child2.2
    • Child2.3

My requirement is to have the parent term disabled by default. In case user selects any of the child term, the parent gets automatically selected.

Suggestions?

fotuzlab
  • 1,436
  • 1
  • 15
  • 19

2 Answers2

4

You can modify the value of the reference field on save. If node entity use hook_node_presave(). First get the original tid & load it using taxonomy_term_load() to get term object, get parent id from that and replace it in the reference field.

3

The Term Reference Tree Widget Module provides a nice interface for selecting terms and gives an options to select the parent term when selecting the child.

splatio
  • 504
  • 4
  • 12