Fluid - condition to check if value is NULL not working

Black picture Black · Jan 25, 2017 · Viewed 6.9k times · Source

I try to output my element only if the value of the property fileEn is NULL (fileEn => NULL)

<f:if condition="{file.fileEn}==NULL">
    <f:debug title='file'>{file}</f:debug>
</f:if>

However this is also showing me elements where fileEn is not NULL!

Answer

Black picture Black · Jan 25, 2017

You can't check if something is NULL like this, it works like this:

Render only if property is NULL:

<f:if condition="{file.fileEn}">
    <f:then>

    </f:then>
    <f:else>
        <!-- Property is NULL -->
        <f:debug title='file'>{file}</f:debug>
    </f:else>
</f:if>

Render only if property is NOT NULL:

<f:if condition="{file.fileEn}">
    <!-- Property is not NULL -->
    <f:debug title='file'>{file}</f:debug>
</f:if>