Skip Navigation

[Resolved] conditional display field if parent field checkbox is checked

This support ticket is created 3 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by simchaH 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2224575
Screenshot (12).png

Hi,

I have this string of code:

[wpv-conditional if="( $(wpcf-contact-role).item(@person-to-shiur.parent) eq '3' )"]

I am trying to check the checkbox called contact-role which is located in the person CPT, and see if the 3rd option is checked. I already have entered a shortcode to display if the checkbox is checked:
[types field="last-name" item="@person-to-shiur.parent"]

But the conditional IF is not working, because when I take it away, the shortcode populates. Am I doing something incorrect with the eq '3'? See screenshot below, I saved the checkbox value to store as 3, since it is the 3rd option in the contact-role checkbox group.

Thanks!

#2224609

Hello,

How do you setup the "contact-role" field? is it a custom checkboxes field(multiple choices) or checkbox field(single choice) ?
How do you setup the post type relationship? one-to-many relationship?
Where do you setup the field group of "contact-role"? is it in parent post type?

Please provide detail steps to reproduce the same problem, thanks

#2225001

I noticed that I don't need to conditionally display based on the checkbox because each one can only have one person assigned to it, so there is no issues.

My issue is resolved now. Thank you!