Skip Navigation

[Resolved] Conditional Output based on Checkboxes Field

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Nashaat 4 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1354583

I am trying to show conditional output based on a checkboxes field (Field Type = checkboxes ). It's not a single checbox.

[wpv-conditional if="( $(wpcf-winners) eq '1' )"]Winner 1[/wpv-conditional]
[wpv-conditional if="( $(wpcf-winners) eq '2' )"]Winner 2[/wpv-conditional]
[wpv-conditional if="( $(wpcf-winners) eq '3' )"]Winner 3[/wpv-conditional]
[wpv-conditional if="( $(wpcf-winners) eq '4' )"]Winner 4[/wpv-conditional]

The output of the field looks like following:
1, 4
1, 2, 3, 4

How can i check if one of the values is equal then show true ?

#1354741

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

The checkboxes field needs special handling, you need to specify which option you are testing.

There is an example in the documentation here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/#checking-types-checkboxes-field-for-non-empty-value

#1355569

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.