Answers.Body: <p>You can get a dropdown field's selected value by using <code>entry.fieldhandle.value</code>. So <code>if entry.fieldhandle.value|length</code> should do the trick. I think you can even omit the <code>length</code> filter in this case, as if you do it with the plain text field. Both an empty string and the length of an empty string resolve to <code>false</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-30T14:36:12.627Z
Answers.LastActivityDate: 2016-12-30T14:36:12.627Z
Answers.UserDisplayName: Johannes
Body: <p>In a Matrix field i want to check if block.logolink (simple text) <strong>OR</strong> block.logolinkDropdown (dropdown with empty field) are empty or not:</p>
  
  <pre><code>{% if block.logolink or block.logolinkDropdown %}
  </code></pre>
  
  <p>If i check them with {{ block.fieldHandle }} they're empty. But still it passes the condition.</p>
  
  <p>Where's my mistake in this statement?</p>
  
  <pre><code>{% for block in entry.logomatrix %}
  {% switch block.type %}
  
  {% case "logo" %}
  {% if block.logobild %}
      {% for logo in block.logobild %}
      {% if block.logolink or block.logolinkDropdown %}
          {% if block.internerLink %}
              &lt;a href={{ block.logolink }}{{ block.logolinkDropdown }}&gt;
          {% else %}
              &lt;a href={{ block.logolink }}{{ block.logolinkDropdown }} TARGET="_blank"&gt;
          {% endif %}
      {% else %}
          &lt;a href="{{ logo.getUrl('logogross')}}" data-lightbox="image" data-title="{{ block.logobeschreibung }}"&gt;&lt;/a&gt;
      {% endif %}
  
      {% endfor %}
  {% endif %}
  
  {% case "textbutton" %}     
  ...
  
  {% endswitch %} 
  {% endfor %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-30T12:04:31.627Z
Comments.Text: Did you try Twig's length filter?
Comments.UserDisplayName: Johannes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-30T12:37:27.447Z
Comments.Text: Yes, i tried the length filter first. It ouputs a 0 for the "block.logolink" and a 1 for the "block.logolinkDropdown", altough a empty field is chosen in the  dropdown.
Comments.UserDisplayName: TomS
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-30T12:42:55.027Z
Comments.Text: And how about block.logolinkDropdown.value|length?
Comments.UserDisplayName: Johannes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-30T14:29:41.977Z
Comments.Text: That's the solution! It explains also some other questions i had. Thank you very much rostockahoi.
Comments.UserDisplayName: TomS
Tags: <matrix>
Title: Checking if Matrix fields are empty or not?
ThreadText: # Checking if Matrix fields are empty or not?
  
  (Asked by: username_0 on 2016-12-30)
  
  In a Matrix field i want to check if block.logolink (simple text) **OR** block.logolinkDropdown (dropdown with empty field) are empty or not:
  
  ```
  {% if block.logolink or block.logolinkDropdown %}
  
  ```
  
  If i check them with {{ block.fieldHandle }} they're empty. But still it passes the condition.
  
  Where's my mistake in this statement?
  
  ```
  {% for block in entry.logomatrix %}
  {% switch block.type %}
  
  {% case "logo" %}
  {% if block.logobild %}
      {% for logo in block.logobild %}
      {% if block.logolink or block.logolinkDropdown %}
          {% if block.internerLink %}
              <a href={{ block.logolink }}{{ block.logolinkDropdown }}>
          {% else %}
              <a href={{ block.logolink }}{{ block.logolinkDropdown }} TARGET="_blank">
          {% endif %}
      {% else %}
          <a href="{{ logo.getUrl('logogross')}}" data-lightbox="image" data-title="{{ block.logobeschreibung }}"></a>
      {% endif %}
  
      {% endfor %}
  {% endif %}
  
  {% case "textbutton" %}     
  ...
  
  {% endswitch %} 
  {% endfor %}
  
  ```
  
  **Tags:** matrix
  
  > **Comments:**
  > **username_1**: Did you try Twig's length filter?  
  > **username_0**: Yes, i tried the length filter first. It ouputs a 0 for the "block.logolink" and a 1 for the "block.logolinkDropdown", altough a empty field is chosen in the  dropdown.  
  > **username_1**: And how about block.logolinkDropdown.value|length?  
  > **username_0**: That's the solution! It explains also some other questions i had. Thank you very much rostockahoi.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-30. Score: 4 | Accepted answer
  
  You can get a dropdown field's selected value by using `entry.fieldhandle.value`. So `if entry.fieldhandle.value|length` should do the trick. I think you can even omit the `length` filter in this case, as if you do it with the plain text field. Both an empty string and the length of an empty string resolve to `false`.
  
  
  ---
  
  