Skip Navigation

[Resolved] Conditional HTML testing a radio field value is not working as expected

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a conditional HTML block that tests the value of a custom radio field, but it's not working as expected.

Solution: Check the field slug. In this case a similar field was selected in the conditional builder dialog, and that led to the wrong field being tested.

This support ticket is created 6 years 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by lauraH-2 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#644352
register-button.png
Edit Content Template ‹ James Jealous D.O. — WordPress.png

I am trying to: On this page: hidden link
I'm trying to show registration buttons if courses are marked "Open" using a custom field.

The page above is showing courses like this one: hidden link

And is using this content template: hidden link

Here is the code I'm using:

[wpv-conditional if="( $(wpcf-bio-course-status) eq 'open' )"][types field="course-registration-url" title="Register5" class="extra-class" style="display: block; margin-top: 10px; padding: 10px 25px;background-color: #49adde; color: #fff; text-align: center;"][/types][/wpv-conditional]

You'll see the bio course status has two radio options, either open or closed. I tried several options using numbers instead of the word or using false instead of true, but can't get the buttons to show unless I remove the conditional statement.

Thanks for your help!

#645009

Hi, sorry but I didn't receive login credentials so I cannot see the custom fields in wp-admin. I don't see anything obviously wrong in the conditional, so please activate debug mode by adding debug="true" to the wpv-conditional, and let me know what is displayed:

[wpv-conditional if="( $(wpcf-bio-course-status) eq 'open' )" debug="true"][types field="course-registration-url" title="Register5" class="extra-class" style="display: block; margin-top: 10px; padding: 10px 25px;background-color: #49adde; color: #fff; text-align: center;"][/types][/wpv-conditional]

I will activate private reply fields here so you can share login credentials if you'd like.

#645045

It looks like the slug of the course status custom field is not accurate in the conditional. In the custom field editor, I see the slug is "course-status", so I think the correct conditional should be:

[wpv-conditional if="( $(wpcf-course-status) eq 'open' )"][types field="course-registration-url" title="Register5" class="extra-class" style="display: block; margin-top: 10px; padding: 10px 25px;background-color: #49adde; color: #fff; text-align: center;"][/types][/wpv-conditional]

Try that and let me know if the problem is not resolved.

#645047

Weird because I let Toolset fill that all in, but your suggestion works. Thanks much!

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