<p>At least with the <a href="https://github.com/craftcms/ckeditor/releases/tag/1.0.0-beta.2" rel="nofollow noreferrer">1.0.0-beta2</a> release of the plugin (which is using an old  CKEditor 5 Developer Preview v0.11.0) build, an empty field will will output an <code>&lt;p&gt; &lt;/p&gt;</code> tag pair.</p>

<p>This behavior might change once it gets updated to a stable release.</p>

<p>Kinda lame, but for now you could do something like this:</p>

<pre><code>{% set entry = craft.entries.id(2).one() %}

{% set emptyCKEditor = "&lt;p&gt; &lt;/p&gt;" %}

{% if entry.ckeditor == emptyCKEditor %}
    EMPTY
{% else %}
    NOT EMPTY
{% endif %}
</code></pre>

CC BY-SA 4.0
2018-10-10T17:41:37.490Z
2018-10-10T17:41:37.490Z
Brad Bell
<p>Brad's answer should work - it makes perfect sense and it is technically correct - but for some reason it didn't for me.</p>

<p>Given that the goal for me was to become unstuck rather than explore the reason why, I did something that is not by any means precise, but it does the job.</p>

<p>I just tested against the length of the ckeditor field contents, the assumption being that, since this is a rich text field containing HTML code, it is highly unlikely (at least in my case) that the length of the string contained will be less than </p>

<p><code>&lt;p&gt;&amp;nbsp;&lt;/p&gt;</code></p>

<p>(which is what my setup was spitting out). My work-around:</p>

<pre><code>{% if entry.ckeditor|length &gt; 11 %}
  EMPTY
{% else %}
  NOT EMPTY
{% endif %}
</code></pre>

CC BY-SA 4.0
2019-11-07T13:37:10.203Z
2019-11-07T13:37:10.203Z
Leonidas Kossis
<p>I'm using CKEditor as one of my fields, I'm trying to detect if there is any content within them, unfortunately it's still appearing even using the below code (and the field is actually empty).</p>

<pre><code>{% if entry.formal is empty %}

{% else %}
&lt;dl class="row"&gt;
  &lt;dt class="col-sm-3"&gt;Description lists&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{ entry.formal }}&lt;/dd&gt;
&lt;/dl&gt;
{% endif %}
</code></pre>

<templating><ckeditor5>
CKEditor Null Value
# CKEditor Null Value

(Asked by: username_0 on 2018-10-02)

I'm using CKEditor as one of my fields, I'm trying to detect if there is any content within them, unfortunately it's still appearing even using the below code (and the field is actually empty).
{% if entry.formal is empty %}

{% else %}

  Description lists
  {{ entry.formal }}

{% endif %}

**Tags:** templating, ckeditor5


---

## 2 answers

### Answer by username_1 on 2018-10-10. Score: 1 | Accepted answer

At least with the 1.0.0-beta2 release of the plugin (which is using an old  CKEditor 5 Developer Preview v0.11.0) build, an empty field will will output an   tag pair.
This behavior might change once it gets updated to a stable release.
Kinda lame, but for now you could do something like this:
{% set entry = craft.entries.id(2).one() %}

{% set emptyCKEditor = " " %}

{% if entry.ckeditor == emptyCKEditor %}
    EMPTY
{% else %}
    NOT EMPTY
{% endif %}


---

### Answer by username_2 on 2019-11-07. Score: 1

Brad's answer should work - it makes perfect sense and it is technically correct - but for some reason it didn't for me.
Given that the goal for me was to become unstuck rather than explore the reason why, I did something that is not by any means precise, but it does the job.
I just tested against the length of the ckeditor field contents, the assumption being that, since this is a rich text field containing HTML code, it is highly unlikely (at least in my case) that the length of the string contained will be less than 
 
(which is what my setup was spitting out). My work-around:
{% if entry.ckeditor|length > 11 %}
  EMPTY
{% else %}
  NOT EMPTY
{% endif %}


---

