How to modify term reference field in Drupal 7 custom content type? I am using a term reference field in a content type in Drupal 7 which is a long hierarchical list of categories. In the input form, I want to show them as checkboxes and it gets displayed as a flat list of around 100 items and that of course is not user friendly at all. What hook do I use or where do I manipulate the code of the generated field so that I can display them in a hierarchical way and at the same time use some jQuery to show hide the sub categories. I guess I can intercept it in the theme preprocess and modify the field but I believe theres a better way?
Try the Taxonomy Term Reference Tree Widget.


  This module provides an expandable tree widget for the Taxonomy Term Reference field in Drupal 7. This widget is intended to serve as a replacement for Drupal's core Taxonomy Term Reference widget, which is a flat list of radio buttons or checkboxes and not necessarily fit for medium to large taxonomy trees.


Sounds like it would be perfect for your needs, but if not it's fully themable and already has the jQuery functionality built in so would be a very good place to start.