modxcms / fred

The friendly front-end editor for visual, drag-and-drop content building in MODX CMS
https://fred.modx.com
MIT License
59 stars 25 forks source link

Option type toggle #398

Closed sottwell closed 4 months ago

sottwell commented 3 years ago

Option type "toggle" doesn't appear to work. The item will have the default value, whether true or false, but switching the toggle has no effect.

Changing the type to "text" and entering true or false in the text field works as expected.

sottwell commented 3 years ago

The "toggle" type returns "1" for true and empty "" for false. <a class="btn btn-primary" href="/" data-fred-render="">Call to Action!</a> <a class="btn btn-primary" href="/" data-fred-render="1">Call to Action!</a>

lottaar commented 3 years ago

I just noticed this as well, glad I'm not alone. The false value isn't returned until the theme is rebuilt.

https://community.modx.com/t/fred-toggle-not-returning-false-value/3667

lottaar commented 5 months ago

Still an issue in Fred 2.2.3

matdave commented 4 months ago

{% if toggle %}<a class="btn btn-primary" href="/">Call to Action!</a>{% endif %}

matdave commented 4 months ago

or <a class="btn btn-primary" href="/" data-fred-render="{% if toggle %}1{% else %}0{% endif %}">Call to Action!</a>