Bug #23759 Accepted

If statements with Fluid toggles don’t work as documented

Version: 4.3.6 Reporter: dgtlmkt


The if statement shown in the document above won’t display the text when the field is toggled to ON. The {content} block must be included in order for the text to appear, like so:

    {if content}
      YES there is a toggle value!
  • There are some quirks with toggle conditionals depending on your server configuration and/or if the field was added with a default value to existing entries but those entries were not re-saved. We do want to fix this, but you may be able to work around it with either:

    {if content != 0}


    {if '{content}'}
    Derek Jones
    17th October, 2018 at 12:18pm
  • I appreciate that Derek, thank you. The first didn’t work for me, but the second did, so I’ll run with that one.

    17th October, 2018 at 12:31pm
  • I sent my initial response a little too quickly and had not properly tested.

    {if '{content}'}

    The above always evaluates as true to me, regardless of the toggle’s status. However, this statement works as I expect it to:

    {if '{content}' == '1'}
    17th October, 2018 at 1:39pm
  • Good catch, the reasoning:

    {if '0'}

    Evaluates as TRUE, because that is a non-empty string. If you remove the quotes, however:

    {if {content}}

    Then it’s either

    {if 0}


    {if 1}

    Which evaluate to a boolean in a more intuitive manner.

    Derek Jones
    17th October, 2018 at 2:00pm

You must be signed in to comment on a bug report.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases