Skip Navigation

[Resolved] Using Relationships in Conditions in a Conditional Group in a Form

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

Problem: I would like to use conditional groups in Forms to test the selected parent post.

Solution: You can use the following syntax to test the selected parent:

[cred_show_group if="( $(@relationship-slug.parent) eq '12345' )" mode="fade-slide"]
Show this content when the parent has ID 12345
[/cred_show_group]

Replace relationship-slug with the slug of the relationship, and replace 12345 with the ID to test.

0% of people find this useful.

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

Last updated by alexG-4 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1235642

I want to display a Conditional Group in a form, depending on a relationship value selected in the form.

But I can't see the Relationship appearing in the drop-down for selecting the condition(s).

Does that mean this is not possible?

#1235692

Hi, it's possible to target that field in the Form editor's Expert mode. If you're creating child posts in the Form and selecting parent posts, you can use this shortcode as a template:

[cred_show_group if="( $(@relationship-slug.parent) eq '12345' )" mode="fade-slide"]
Show this content when the parent has ID 12345
[/cred_show_group]

Replace 12345 with the numeric ID of the parent you want to target, and replace relationship-slug with the slug of the relationship.

#1236084

That works perfectly.

Thanks, Christian.

Alex