Checkbox TV issue

I have a TV with type of Checkbox.
It’s called ‘fullyBooked’, and the input value is ‘yes==1’.

in my template I have this:

[[*fullyBooked:is=`1`:then=`show this HTML`]]

But when the TV is checked, it doesn’t show anything.
I must be missing something obvious, but i’ve spent ages trying to work it out - I think it’s a friday feeling, but any pointers as to why?

Thanks!
Andy

I can’t reproduce this issue.
It works correctly when I test it.

Does [[*fullyBooked]] output 1?

Yes it does! Was the first thing I tried in case o was being stupid! :slight_smile:

If you instead use

[[*fullyBooked:is=`1`:then=`show this HTML`:else=`other HTML`]]

does the content from the else clause get shown?
Is the “show this HTML” part valid HTML?


Is this MODX tag nested in other tags?
Does the TV have an “Output Type” settings that is different from Default?

Maybe yes==1 contains some whitespace in the TV settings.


What version of MODX & PHP are you using?

Thanks harry.

Is this MODX tag nested in other tags? NO
Does the TV have an “Output Type” settings that is different from Default? NO

Maybe yes==1 contains some whitespace in the TV settings. I CHECKED AND NO

So if I put this in my template:

            [[*fullyBooked:is=`1`:then=`show this HTML`]]

it works.
but if I use the actual html I want to show:

            [[*fullyBooked:is=`1`:then=`
<div class="fullyBooked">
        <div>
            <h2 class="mb20">We are fully booked.</h2>
            <p>Bookings  for [[!+nowdate:default=`+2 month`:date=`%B %Y`]] will be available on the 1st [[!*nowdate:default=`+1 month`:date=`%B`]] at 7pm.</p>
        </div>
    </div>
`]]

It doesn’t work! It tuns out that the reason it’s not working is due to the date code:

[[!+nowdate:default=`+2 month`:date=`%B %Y`]]

If I remove this - it works.
Any ideas why this is?

Does it need to be an asterisk not a plus sign?

[[!*nowdate:default=`+2 month`:date=`%B %Y`]]

With the MODX parser, it always gets tricky when there is an uncached tag inside a cached tag. Because embedded tags are parse before the surrounding tag, but cached tags are parsed before uncached tags, this creates a contradiction.

In this case it seems that MODX 3 can handle this kind of tag, but MODX 2 fails.

The solution is to either make the surrouding tag uncached as well

[[!*fullyBooked:is=`1`:then=`<p>Bookings  for [[!+nowdate:default=`+2 month`:date=`%B %Y`]] ...</p>`]]

or to move the inner HTML to a chunk:

[[ [[*fullyBooked:is=`1`:then=`$FullyBookedChunk`]] ]]

Chunk “FullyBookedChunk”

...
<p>Bookings  for [[!+nowdate:default=`+2 month`:date=`%B %Y`]] ...</p>
...

Aha thanks Harry. Perfect.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.