This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

jcbbuller52235
jcbbuller52235

I'm having a hard time trying to find examples of building a simple if then statement on a checkbox control using the Rainlab Builder plugin. Anyone know of a simple example I can work with?

jcbbuller52235
jcbbuller52235

Found the answer: Record.feature is a boolean field that I assigned to the checkbox control. I write an if statement to check if it's true. If it is then I output the record title, if not then it doesn't show. Let me know if there's anything I'm missing.

Example:

{% for record in records %}
       {% if record.feature %}
             <h3>{{ record.featured_title }}</h3>
       {% endif %}
{% else %}
        <p>No records available</p>
{% endfor %}

Last updated

daftspunky
daftspunky

Looks good to me!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.