Conditional Logic on Post Categories

Conditional Fields are those fields that rely on users’ specific actions on some other input fields. If the determined fields are not triggered, then these conditional fields will not work. Now, you can add Conditional Logic to your Post Categories in Fluent Forms. Where the input fields of those categories will appear, that has a fixed category value.

This tutorial demonstrates how to set Conditional logic on Post categories. 

The first step is to create a Post Form, by clicking on the Arrow icon in the Add a New Form button. Then select the Post Type as post for that form.

In the form editor, go to the Taxonomy Fields and select the Categories field. Then go to Post Fields & choose the Post Title and Post Content field. Next, suppose you select the Simple Text and Numeric Field from the General Fields. Click the Save Form button.

Go to the Settings & Integrations tab of the form and click on Post Creation. Here, click on Add Post Feed to create a new post feed. You will notice some options appear for configuring the feed.

Give a name to your post feed then scroll down to the Advanced Custom Fields Mapping section. And in the General Fields select Text from the ACF Fields option. Then you need to add another ACF field which is the Number field by clicking the Add Another General Field button.

Then add the Form Field for the two fields respectively on the right-hand side. Lastly, click on the Save Feed button.

Now here comes the important part. If you want the Text & Number fields to only appear when specific categories are selected. This can be done by using Conditional Logic. Go to the Input Customization option & select Yes on the Conditional Logic option. In order to match the condition of the category, you need to fetch the values of that particular category. To do so, preview the form and right-click on the Inspect Element. Then tap on the Category field to open the code that contains the category values.

So in this example, the ‘a guest’ category has been chosen for both Text & Number fields. Which has a value of 73 after inspecting the form. Then this value will be added in the conditional logic. After that, don’t forget to save the form.

Now, in the Preview mode when you select the ‘a guest’ category. Only then the Text and Number field will appear, and not otherwise. Therefore, this is how you can apply the Conditional logic on Post Categories.

Was this article helpful to you?

How can we help?

Please submit a support ticket if you have any question or pre-sale questions. Our Customer support engineers will answer your query as soon as possible

Open a support ticket