Skip Navigation

[Resolved] Conditional display of form inputs based on Taxonomy

This support ticket is created 3 years, 9 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
- 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 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1695353

Hello,

I want to implement conditional display of form inputs based on taxonomy and I can't get it to work.

I reviewed this document and followed the instructions:
https://toolset.com/course-lesson/conditional-display-for-form-inputs/

The Listing Types taxonomy that I set up has Food & Beverage and Tourism as Parent taxonomies and Restaurant and Accommodations as their respective children. I set up the Listing custom post type, a listing field group (with common/shared fields between restaurants and accommodations), a restaurant field group, and accommodations field group.

I'm now in the Edit Post Form screen, I've added Conditional Groups and was hoping to be able to choose the custom field Accommodations Class if the taxonomy selected is Accommodations. When I click on the select menu for Field under the Conditional Group Options, I can only see the custom fields that are in the listing, restaurant, and accommodations field groups that I set up. The taxonomy Listing Types is included on the form, but it is not showing up as something that I can select in the Conditional Group Options Field menu.

I saw that other people have had similar trouble with this so I tried setting display options for the taxonomy as a set of checkboxes, a select dropdown, and a select dropdown with multiple selection, saving the form in between each change that I made and none of those options caused the Listing Types taxonomy to show up as a field option that I could use for the condition/if statement.

Then I deleted all of the children taxonomies in Listing Types thinking maybe it was the parent/child thing that was throwing this off and tried the same combinations, also I allowed the user to add new taxonomies which I had turned off before and it still doesn't work.

I am using all of the latest versions of the various Toolset plugins.

Any ideas?

Thanks,
Jen

#1697717

Dear Jen,

You are right, there isn't option for taxonomy within Conditional Group UI, you need to setup the condition manually:
Add a Conditional Group into your form content, click link "Edit conditions manually", then follow our document to setup the condition codes:
https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/

For example:

($(category) eq 'term B') OR ($(category) eq 'term A')

Please replace "category" with your custom taxonomy slug, replace "term B" and "term A" with specific term's name.

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