Adding Form Conditions to Selectively Display Fields

  • Updated

Form Conditions change the content shown to your form's visitors based on the information they provide. Conditions dynamically hide or reveal form blocks and sections as contacts fill out your form, improving the user experience by reducing the time and effort needed to complete it.

Example Use Cases

  • Ask specific questions or hide irrelevant questions for contacts with particular characteristics (for example, certain lead contacts)
  • Display a drop-down for State/Territory/Province when contacts select their geographical location
  • Prevent unwanted form submissions by hiding the submit button (see also: How to Suppress Form Submissions)

Getting Started

You'll find form conditions settings in the Design tab of the Forms Composer. Before adding any conditions, you should complete your form's design and make sure all necessary fields are included. To do this:

  1. Add all the fields you'd like to gather contact information with into your form
  2. Add a Submit button
  3. Save the form

Need help creating your form? See our Forms Composer User Guide for additional guidance.

Every form condition includes a pair of IF and THEN statements that define your form's behavior. 

Form Condition Statement Description Components  Example
IF

The IF statement defines a contact's response as a triggering action on your form.

If, State, and Value

Clicking a checkbox next to "Yes, I would like to be contacted by an agent."

THEN

The THEN statement defines the form's behavior when triggered by the IF statement. 

Do, and Field

Revealing different time slots where the contact can indicate their availability. 

Instructions

Step 1: Add a New Form Condition

  1. Go to Content > Forms
  2. Hover over your form's name and click Edit to open it in the Forms Composer
  3. In the Forms Composer, go to the Design tab
  4. In the right-hand Settings panel, click Form Conditions 
  5. Click Add Rule to create a new rule for your form
  6. Enter a Rule Name – if your form has multiple rules, use names to remember the purpose of each 

Optional: Check the Case Sensitive box if you'd like your condition's values to be case sensitive

Step 2: Set an IF Statement

The IF statement defines the behavior or response by form visitors that will activate your form's condition. When a form visitor meets this condition, it will trigger your form to hide or show the field selected in Step 3. You'll need to fill the following fields to create your IF statement: If, State, and Value

Components Input How it works

If

Select one of your form fields from the drop-down menu

Select the form field that will activate your form condition.

You can apply multiple IF statements by using AND and/or OR to create more complex conditions for your form.

State

Select a qualifier from the drop-down menu

(Is Equal To, Contains, Starts With, etc.)

Set the logic for how values entered in the above field will meet your form condition. 

Value

Free text entry

Enter the value that form visitors must enter to trigger the condition.

If you've selected "Is Empty" or "Is Filled" for State, you do not need a Value.

For a multiple-choice field (picklist, combo box, etc.), the value must match exactly or the form condition may not function as expected.

Heads up! Your form condition will stop working if you delete the form field used to create the above IF statement. Be sure to test your condition after editing or deleting any form fields.

Step 3: Set a THEN Statement

Your THEN statement defines how your form dynamically changes when the above IF condition is activated. If your contact's behavior or form response triggers the condition set by your IF statement, the THEN statement tells your form to hide or show another field.

You'll need to set the following components for each THEN statement: Do and Field

Components Input How it works

Do

Select Hide or Show from the drop-down menu

Select whether to hide or show the below field when your contact meets conditions set by your IF statement.

Hide:

  • The below field will show when the form first loads
  • The below field will disappear when your contact enters a response that triggers the condition set by your IF statement field
  • This prevents your contact from submitting irrelevant data

Show:

  • The below field will be hidden by default when the form first loads
  • Your contact will only see the below field appear when they meet the IF condition
  • This allows you to ask increasingly relevant questions based on the data you’ve collected in existing fields

Field

Select one of your form fields from the drop-down menu

You cannot select the same field used in your IF statement

Select which form field will dynamically appear or be hidden when your contact's behavior activates the IF condition.

Once you have set both IF and THEN statements, click OK to save your new form rule. Click Close to exit the Form Conditions panel.

Special features & options for THEN statements

Dynamic Submit Button

Hide or show the form's submit button to suppress form submissions. For more information on how or why to use this feature, see How to Suppress Form Submissions.

Dynamic Form Sections

Set your condition's logic to hide or show entire form sections. This makes the conditional logic simpler and easier to manage when you have multiple fields to hide or show. Each form section is assigned a number and will appear as Section [no.] in your THEN statement's Field drop-down menu.

Dynamic Content Blocks, Images, and Text

Show specific content blocks, such as Rich Text or Images. This allows for custom messages or images to show on your form based on how your form visitors complete your conditional fields.

Multiple THEN Statements (Advanced)

Use multiple THEN statements to have multiple results occur based on actions defined by your IF statement. Create additional THEN statements for your form condition by clicking AND.

Step 4: Test Your Form Condition

Save your form before testing. You won't be able to test form conditions without saving first.

Test in the Forms Composer (recommended)

  • Go to the Review tab in the Forms Composer to preview your form
  • Fill out your form fields to see whether it hides or shows conditional fields as expected

Test your live form

  • Visit the form where it's been embedded (for example, a landing page accessed via public URL).
  • Fill out your form fields to see whether your form dynamically hides or shows fields as defined by your condition rules.

Pay attention to the following when creating and testing your form conditions:

  • It is always the best practice to test your form prior to launch. To ensure the logic is functioning as expected, run tests for all conditions and response combinations.
  • Multiple form conditions may cancel each other out or cause usability errors if set up incorrectly. If you see these errors during testing, check each condition's logic and fields selections to make sure they won't cancel out settings for another condition.
  • Form conditions are not the same as progressive profiling sections and will produce different results when visitors fill out your form. See the below FAQs section to help you decide which form feature will best meet your goals.

Example Use Case

Create a Single Contact Form for Leads & Customers

This example demonstrates how to use form conditions to create a single dynamic form for both leads and existing customers. This form will hide or show additional fields and questions depending on whether the form visitor is an incoming lead or a current customer.

  IF... THEN... Example

Customer

If the contact responds "Yes" to the below field:

If = "Are you a current  customer?"

State = Is Equal To

Value = "Yes"

Then the form responds by asking the customer for their account number.

Do = Show

Field = "Account Number"

Form_Conditions_1.png

Lead

If the contact responds "No" to the below field:

If = "Are you a current customer?"

State = Is Equal To

Value = "No"

Then the form responds by asking for their lead source.

Do = Show

Field = "How did you hear about us?"

Form_Conditions_2.png

Lead Source = Friend

If the contact answers "Friend" to Lead Source field:

If = "How did you hear about us?"

State = Is Equal To

Value = "Friend"

Then the form responds by asking for the Friend's contact name.

Do = Show

Field = "Who can we thank"

Form_Conditions_3.png

 

FAQs

How are Form Conditions different from Progressive Profiling?

Form Conditions:

  • Set rules to hide and show form fields or form sections based on a contact's responses at the moment they're completing your form.
  • This is useful for collecting only information that is relevant, hiding fields that do not apply to a particular contact or asking certain contacts additional questions.

Progressive Profiling:

  • Used for leads and contacts who will be completing a single form multiple times (e.g., for gated content)
  • Set rules to limit the number of fields that show each time the contact completes the same form.
  • Slowly gather more profile information each time an engaged lead fills out the same form.
  • See our user guide on Progressive Profiling for more information.

How do I save a set of Form Conditions to use in future forms?

You can save a set of form conditions by creating a Form Template. Use this template as a starting point for each new form where you'd like to apply the same conditional logic.

How can I hide my form fields when the page loads and show them later?

Do this by creating a condition with a THEN statement set to Show. Your form will automatically hide any field set to Show via a form condition and will reveal the field only when your THEN statement's rule is met.

Was this article helpful?

Have more questions? Submit a request