Skip Navigation

[Resolved] Post form conditional group for taxonomy

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

Problem:

I can't figure out how to show something based advanced display on selected taxonomy in form.

Solution:

If it is a taxonomy checkboxes field, you can compare with the term's title, for example:

https://toolset.com/forums/topic/post-form-conditional-group-for-taxonomy/#post-1829417

If it is a taxonomy select field, you can compare with the term's ID, for example:

https://toolset.com/forums/topic/post-form-conditional-group-for-taxonomy/#post-1831631

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/

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

Our next available supporter will start replying to tickets in about 1.36 hours from now. Thank you for your understanding.

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 4 replies, has 2 voices.

Last updated by katjaL 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#1828271

According to this document https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/ I understand it should be possible to set condition in form based on taxonomy. "You can control display for form sections from Forms’s GUI. This will allow to create simple display logic, involving custom fields and taxonomy."

But I can't figure out how to show something based on selected taxonomy in form. It's pretty simple to show something based on custom field though. Perhaps I'm missing something now, would you please inform me, thank you.

#1829417

Hello,

You are referring the correct document, for taxonomy field, you will need to compare with the term's title, for example:

[cred_show_group if="($(category) eq 'Term title A' )" mode='fade-slide']
Show something here
[/cred_show_group]
#1829519

Thank you Luo. I couldn't make it work. Perhaps there is something wrong with my "trigger". This is the code (tried with Ajax on and off):

[cred_field field='mycustomtaxonomy' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
[cred_show_group if="($(mycustomtaxonomy) eq 'The taxonomy name in select' )" mode='fade-slide']
Show something here[/cred_show_group]

#1831631

You are using single select, so you need to compare with term's ID, for example:

[cred_show_group if="($(category) eq '123' )" mode='fade-slide']
Show something here
[/cred_show_group]
#1832059

Hi Luo, yes! That's it - my issue is resolved now. Thank you!