Display different fields depending on field value in node template I have a field named field_event_type. When creating a node, you can select one of two options for this field from a drop-down list:


birthday party 
Wedding


I want to be able to display different fields in my node depending on which type of event is selected. So in node--events.tpl.php, my node template, I wrote the following:

if ($element['#object']-&gt;field_event_type['und'][0]['value'] == 'birthday party' )
   {
      print render($content['field_some_field']);
   }

else
   {
      print render($content['field_some_other_field']);
   }


However, this does not seem to be working the way I intended it to, not only is it not displaying the additional field content in either event type, but I'm also getting an error in Drupal about an undefined variable. Is my code incorrect?
You may find it easier to use the Conditional Fields Module:


  Conditional Fields allows you to manage sets of dependencies between
  fields. When a field is “dependent”, it will only be available for
  editing and displayed if the state of the “dependee” field matches the
  right condition. When editing a node (or any other entity type that
  supports fields, like users and categories), the dependent fields are
  dynamically modified with the States API. You can, for example, define
  a custom “Article teaser" field that is shown only if a "Has teaser"
  checkbox is checked.