0

I'm using P&T Fieldpack (2.1.1), EE 2.9.2 and Matrix 2.6. I have a column in my Matrix field that has 2 checkboxes: "text" and "picture".

If only the "text" checkbox is checked then this works to determine that:

{if my_matrix_column == "text"}popup{/if}

But if both are checked, that never returns true. So I try this:

{if '{my_matrix_column:selected option="text"}'}popup{/if} 

and that resolves to true every time - even if nothing at all is checked.

So, any ideas on how I can tell if the "text" checkbox is selected no matter if the "picture" checkbox is selected or not?

2

I had the same problem post upgrade from EE 2.8 to 2.10 and found that I needed to change the conditionals as follows to make them work again:

{if '{my_checkboxes:selected option="value"}' == '1'}
1
  • Second this solution for EE 2.9+ (at least) ... seems to strictly evaluate the truthy value of 1, probably because it's enclosed in quotes. Removing the quotes doesn't work, fyi. Oct 24 '16 at 20:54
1
{if '{my_matrix_column:selected option="text"}'}popup{/if}

This should definitely work, according to the Field Pack docs.

You could also just loop through and do your conditional inside the loop:

{my_matrix_column}
    {if option == "text"}popup{/option}
{my_matrix_column}
3
  • yep - it should work and it did work but after I upgraded to EE 2.9, it doesn't work. I'll try the loop.
    – Chego
    Oct 29 '14 at 19:43
  • using the loop didn't work either.
    – Chego
    Oct 29 '14 at 20:42
  • did you end up coming up with a solution for this? I'm having the same issue but with P&T checkboxes using the :selected conditional...
    – jpea
    Jan 15 '15 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.