Answers.Body: <p>Twig has a "is defined" test that you can apply to a variable to see if it exists:</p>
  
  <pre><code>{% if entry.possibleField is defined %}
      Yup!
  {% else %}
      Nope!
  {% endif %}
  </code></pre>
  
  <p>And here is <a href="http://twig.sensiolabs.org/doc/tags/if.html" rel="nofollow">more</a> information on using <code>is defined</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-26T16:02:07.103Z
Answers.LastActivityDate: 2014-06-26T18:03:46.233Z
Answers.LastEditDate: 2014-06-26T18:03:46.233Z
Answers.UserDisplayName: Patrick Harrington
Body: <p>I've got a generic template that can display entries from different channels. How in the template can I test if a field has been has been assigned to any given channel?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-26T16:00:10.487Z
Comments.Text: Why not check for the field's existence in an entry?
Comments.UserDisplayName: Bryan Redeagle
Tags: <field>
Title: How can I test if a field has been assigned to a channel?
ThreadText: # How can I test if a field has been assigned to a channel?
  
  (Asked by: username_0 on 2014-06-26)
  
  I've got a generic template that can display entries from different channels. How in the template can I test if a field has been has been assigned to any given channel?
  
  **Tags:** field
  
  > **Comments:**
  > **username_1**: Why not check for the field's existence in an entry?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-06-26. Score: 8 | Accepted answer
  
  Twig has a "is defined" test that you can apply to a variable to see if it exists:
  
  ```
  {% if entry.possibleField is defined %}
      Yup!
  {% else %}
      Nope!
  {% endif %}
  
  ```
  
  And here is [more](http://twig.sensiolabs.org/doc/tags/if.html) information on using `is defined`.
  
  
  ---
  
  