How to add conditional fields to Contact Form 7?

Contact Form 7 one of the best contact form plugins for WordPress easy to use and customize, but there are certain caveats, one such thing is adding conditional logic. It should be assisted with either Code or Third-party Plugin. Let’s consider you want to create a form that accepts user input and display related option/field only when certain conditions are met. So how do you add that conditional logic to the form without actually editing the form through code?

       For Example, A user to register with a Fitness center is supposed to select the Time slot. Based on the gender selection the slot has to be displayed.

We don’t want to make our hands dirty with code, let’s do it using a plugin.

Step 1:

Install Conditional fields for contact form 7 plugin from a WordPress repository. Installing the plugin enables an additional tab Conditional fields.

Step 2:

Edit your CF7 form, you see an additional tag named “Conditional fields Group”.  Now, click on Conditional fields group tag and generate a group tag.

Step 3:

The group tag should have a valid and unique name, in order to prevent conflicts and then insert the tag in the form.

               

Now the Conditional group field tag is inserted

Step 5:

Let the part of Contact form that you would like to show and hide based on some conditions, be inserted between these group tags.

Everything you put between the start and end tag will be hidden by default, so to make it appear on your form, Condition rule in the Conditional Fields tab is needed.

Step 6:

Save Your Form for the created fields and groups to show up in the Conditional Fields tab.

Step 7:

The rules to display each group based on the user selection is done from the “Conditional fields” tab.

Ensure the Value entered has its correct spelling, The Value field is Case Sensitive.

Step 8:

Save the Contact form and WE ARE DONE!

 

The working example

 


MaleFemale

4:00-6:00 PM
6:00-8:00 PM
6:00-8:00 AM
8:00-10:00 AM

Posted in Contact Form 7.

Sulaiha is a support execute and customer relation manager at wpisle.

Leave a Reply

Your email address will not be published. Required fields are marked *

twenty − 17 =