Skip Navigation

[Resolved] Post Form conditional group logic based on selected taxonomy term

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

Problem: I would like to use a conditional group in my post Form. The conditional should test whether or not a specific term from a custom taxonomy is selected, but I cannot figure out how to set up this conditional.

Solution: Manually edit the conditions for this conditional group and use the following syntax in the editor:

($(tax-slug) eq 'Term name')

Replace tax-slug with the slug of the custom taxonomy, and replace Term name with the name of the term to test.

Relevant Documentation:
https://toolset.com/course-lesson/conditional-display-for-form-inputs/

This support ticket is created 3 years, 11 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
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 8 replies, has 2 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1978397

I have form I am trying to recreate which has a question called "Research Areas" in which a user can select one or more answers from the list including an "Other" option. Upon selecting this "Other" option, I want a text field to appear for the user to elaborate on this.

Because "Research Areas" are a common attribute for the custom post type, I think is it best suited to a custom taxonomy *which I have created). When I create the form however, I cannot select my taxonomy from the "Field" dropdown in the "Conditions to evaluate" section.

I've tried looking in this article: https://toolset.com/course-lesson/conditional-display-for-form-inputs/ which implies that I can set a condition using taxonomies "You can display or hide elements of the form based on the values of custom fields and taxonomy inputs".

You should be able to see the front end of my form here: hidden link

#1978415

Hi, you would have to edit the conditions manually to add a condition based on a taxonomy field. The syntax is like this:

($(some-tax) eq 'some-term')

Replace some-tax with the slug of this taxonomy, and replace some-term with the slug of the 'other' term.

#1978423

Hi Christian,

Thanks for that, so in this instance the code would be changed to:

($(research-area) eq 'other')

Does that sound right? It doesn't seem to work still.

Thanks,
Mike

#1978429

Okay can you try the capitalized version?

($(research-area) eq 'Other')
#1978433

Awesome, that seems to have done the trick. So is it after the term name, rather than the slug?

#1978435

Correct, I misread my example notes and the correct version is the term name.

#1978437

Awesome. Thanks!
Mike

#1978439

My issue is resolved now. Thank you!

#1978441

Closing out here, feel free to open new tickets as needed.