60Web60

Building Custom Forms with Conditional Logic

Building Your Website4 min read·

This article explains how to create forms that change based on what visitors select, showing or hiding fields as needed.

What is Conditional Logic in Forms

Conditional logic means your form changes based on what someone selects. For example, if someone chooses "Yes" to "Do you need catering?", a new field appears asking for dietary requirements. If they choose "No", that field stays hidden.

Installing a Form Plugin with Conditional Logic

WordPress needs a plugin to create forms with conditional logic. The built-in contact forms don't have this feature.

  1. Go to your WordPress admin dashboard
  2. Click Plugins > Add New
  3. Search for "WPForms" (free version includes conditional logic)
  4. Click Install Now, then Activate

Creating Your First Conditional Form

  1. In your WordPress dashboard, click WPForms > Add New
  2. Choose a template (Contact Form works well for testing)
  3. Give your form a name at the top
  4. The form builder will open with basic fields already added

Adding Fields for Conditional Logic

  1. From the left panel, drag a Multiple Choice or Dropdown field into your form
  2. Click on this field to edit it
  3. Add your options (for example: "Yes" and "No")
  4. Now drag the field you want to show/hide (like a Paragraph Text field for additional details)
  5. Click on this second field to edit it

Setting Up the Conditional Logic

  1. While editing your second field, scroll down to find Conditional Logic
  2. Click the toggle to turn it on
  3. Set the rule: "Show this field if [first field] is [specific choice]"
  4. For example: "Show this field if 'Need catering?' is 'Yes'"
  5. Click Save on the field

Testing Your Form

  1. Click Save at the top right of the form builder
  2. Click Preview to see how your form works
  3. Try selecting different options to make sure fields appear and disappear correctly
  4. If something doesn't work, go back and check your conditional logic rules

Adding the Form to Your Website

  1. Go to Pages or Posts in WordPress
  2. Edit the page where you want the form
  3. Click the + button to add a new block
  4. Search for "WPForms" and select it
  5. Choose your form from the dropdown
  6. Update the page

You can also add forms to your contact pages or use them in booking forms.

Advanced Conditional Logic

For more complex forms:

  • Set multiple conditions (show field if Choice A AND Choice B are selected)
  • Chain conditions (Field C appears if Field B is shown and specific option selected)
  • Use "Hide" instead of "Show" for reverse logic
  • Apply conditions to entire sections, not just single fields

If you're still stuck with setting up conditional logic in your forms, contact Web60 support for help.

FAQ

Q: Can I use conditional logic with the basic WordPress contact form?

A: No, WordPress's built-in contact forms don't support conditional logic. You need a plugin like WPForms or Gravity Forms.

Q: Will conditional logic work on mobile phones?

A: Yes, conditional logic works on all devices. The form will show and hide fields the same way on phones, tablets, and computers.

Q: Can I have multiple conditions for one field?

A: Yes, you can set multiple conditions. For example, show a field only if Field A is "Yes" AND Field B is "Premium package".

Q: What happens to hidden field data when someone submits the form?

A: Hidden fields are not submitted with the form. Only visible fields send their data when someone clicks submit.

Q: Can I make required fields conditional?

A: Yes, you can make a field both required and conditional. It will only be required when it's visible to the user.

Q: Do conditional forms work with email notifications?

A: Yes, your email notifications will only include data from fields that were visible when the form was submitted.

Q: Can I use conditional logic with file upload fields?

A: Yes, most form plugins allow conditional logic on file upload fields. Users will only see the upload option when conditions are met.

Last updated: 1 March 2026