All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Using Checkbox to Activate the Display of Content

Tinch 24 Jun 2012 22:42 question, complete

I have a Checkbox variable type that I want to use to toggle content to display or not, but can't figure out the way to do it. I've been trying to read between the lines on the docs and haven't been successful. This is how I have it currently:

 
{exp:low_variables:options var="lv_content_alert_on"}
{if checked == "checked"}
<div class="alert alert-info">
<button class="close" data-dismiss="alert">×</button>
<strong>Alert!</strong> {exp:low_variables:single var="lv_content_alert_text"}
</div>
{/if}
{/exp:low_variables:options}

Replies

  1. Low 25 Jun 2012 08:28

    The checkbox variable is saved as 'y' when checked, or an empty string if unchecked. This means you can use the regular variable syntax, for example:

    {if lv_content_alert_on == 'y'} 
    {lv_content_alert_text}
    {/if}

  2. Tinch 25 Jun 2012 15:26

    Hmm, that doesn't seem to be working. This is how I have it now:

     
    {if lv_content_alert_on == 'y'}
    <div class="alert alert-info">
    <button class="close" data-dismiss="alert">×</button>
    <strong>Alert!</strong> {exp:low_variables:single var="lv_content_alert_text"}
    </div>
    {/if}

  3. Low 25 Jun 2012 20:44

    Is Early Parsing enabled for that variable?

  4. Tinch 25 Jun 2012 21:22

    That did the trick. Thanks so much Low!