How to

How to work Conditional Fields for Contact Form 7

Before continuing, install Contact Form 7 and Conditional Fields for Contact Form 7 on your WordPress site. Click the Add New button in the WordPress administration to create a new form.

 

Add if/then statements to your form.

Let’s make a drop-down list to choose which fieldset to show and add a text field if a user chooses “Other” from the Operating System select box. We’ll put a drop-down list at the top of the form so you can choose which field sets to show.

 

Make groups of fields.

You will see that Conditional fields Group is a new Contact form 7 tag.

 

Click the tag button to add the group.

Wrap any part of the form that you want to be able to show or hide depending on certain conditions between these group tags, like so. Groups can also be put inside of each other. So, for example, you can make a group around the Advanced fieldset and add another group inside it that can be triggered by the OS choice.

 

Putting things in place

After adding the groups and extra fields, you must save your form first. If you don’t, the fields and groups you create won’t appear in the Conditional Fields tab. After saving the form, we can make the conditions on the Conditional Fields tab.

 

It is essential to spell the value field’s name correctly. The case is critical in the value field. So typing primary fields or Basic-fields instead of the exact phrase Basic fields will not work! The value has to be the same as one of the choices in the drop-down list.

 

The same way can be used to add the other conditions.

You can add more than one line to show more than one group in a single field. In our example, if someone chose to show All fields, both field groups would need to be shown. It can be done by adding the following two rules:

 

  • If pick fields are equal to “All fields,” then primary fields will be shown.
  • If pick-fields are equal to Then, all fields will display advanced fields.