I’m trying to get a class to toggle on a list-item via a simple checkbox utility using a TV and an IF extra statement. I initially referred this forum post.
In the 1st instance I’ve written 2 classes, one for when the checkbox is selected, and another for the else/default fallback condition - this was to test if it was partially working.
Currently the fallback class is all that shows so I guess that means the IF partially works. Ideally I only want to toggle one class for when the checkbox is selected as it doesn’t actually need a fallback.
The TV shows in the content editor, I can select it on/off no problem.
I’ve tried variations on this TV to get it working e.g.: Input Values as only integer 0/1, Input Values empty (no checkbox showed).
These have all been reflected in the IF statement but I always get the same result - only the default fallback class renders in the markup.
I’ve integrated the IF statement on an <li> element - have tried it cached/uncached and with the TV using * or +
I think the default value should just be empty. That syntax for inputs in checkbox and radio TVs is Label==Value, so the values 0 and 1 shouldn’t have the same label of “Keyline”.
Do you use getResources to output this list?
If that is the case, then did you set the property &includeTVs to 1. And what is the value of the property &tvPrefix? If the property &tvPrefix is not set then try
I’d completely forgotten about the getResources aspect of this, which I am using. I’ve not set &tvPrefix and left out the +tv. bit so rolled that in and it’s working perfectly. Also omitted the else condition and it’s working exactly as I want, no need for a fallback class.