I have two fields in my content type that I'd like to have depend on each other. The two fields are category (the dependee, a field list) and icon (the dependent field and also a taxonomy term field). They are both select lists. I want the dependent field (icon) to not be available to authors creating records in the admin interface. It should just automatically select the correct term based on the category selection above it.

I looked into 'Conditional Fields' but I'm not certain it does what I'm looking for.

Any suggestions?

1 Answer 1


If you are looking out to do this through code, you can use hook_form_alter to hide the dependent field and hook_node_presave to set the value for dependent field.

  • thank you. I want to edit the form for the seven theme. If I use hook_node_presave would I do something like 'function seven_node_presave($node)? Or do I need to do something special since this is a default & admin theme?
    – Sage
    Apr 9, 2015 at 1:06
  • hook_node_presave is a module hook and you can have this function in one of your custom modules. Avoid writing custom code in Core or Contributed modules and themes Apr 9, 2015 at 9:10
  • that makes sense; thanks for the clarification, I'll work with that.
    – Sage
    Apr 9, 2015 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.