Formcrafts - a form and survey platform for Salesforce, HubSpot, etc
  1. Templates
    1. All templates illustration
      All templates
    2. Application forms illustration
      Application forms
    3. Calculation forms illustration
      Calculation forms
    4. Lead generation forms illustration
      Lead generation forms
    5. Customer service illustration
      Customer service
    6. Evaluation forms illustration
      Evaluation forms
    7. Survey and feedback illustration
      Survey and feedback
    8. Operations forms illustration
      Operations forms
    9. Payment forms illustration
      Payment forms
    10. Booking and registration illustration
      Booking and registration
    11. Salesforce forms illustration
      Salesforce forms
    12. Other forms illustration
      Other forms
  2. Features
    1. 18 Form Fields illustration
      18 Form Fields
    2. 19 Integrations illustration
      19 Integrations
    3. Conditional Logic illustration
      Conditional Logic
    4. Multi-step Forms illustration
      Multi-step Forms
    5. Calculations illustration
      Calculations
    6. Partial Submissions illustration
      Partial Submissions
    7. Save & Resume illustration
      Save & Resume
    8. Payments illustration
      Payments
    9. Hidden Fields illustration
      Hidden Fields
    10. Dynamic Dropdowns illustration
      Dynamic Dropdowns
    11. Engagement analysis illustration
      Engagement analysis
    12. Multilingual forms illustration
      Multilingual forms
  3. Pricing
  4. Help
  5. Login
  6. Signup
    →
  • Help index
  • Features
    • Conditional logic
    • Prefill forms
    • Multi-step forms
    • Calculations
    • Partial submissions
    • Field references
    • Save and resume
    • Hidden fields
    • Dynamic lookup
    • Workflows
    • Dynamic dropdowns
    • Multilingual forms
    • Privacy mode
    • Success message
    • Form redirect
    • GA/GTM
    • Accept payments
    • Linked forms
    • Disable form
  • Styling
    • Custom CSS
    • Custom fonts
    • Color scheme
    • Form background
  • Analytics
    • Test mode
    • Overview
    • Field analytics
    • Form engagement
  • Workflows
    • Send emails
    • Form redirect
    • Success message
    • Webhooks
    • Create PDF
    • ActiveCampaign
    • Asana
    • Mailchimp
    • Front app
    • Freshdesk
    • Google Sheets
    • Pipedrive
    • Linear
    • Klaviyo
  • Sharing
    • Custom form link
    • Embed on a page (inline)
    • Embed on a page (popup)
    • Embed in emails
    • Embed on WordPress
    • Embed on Shopify
    • Embed on Squarespace
  • Salesforce
    • Overview
    • Create records
    • Update records
    • Related records
    • Dynamic picklists
    • Attach files
    • Create PDFs
    • Form prefill
  • HubSpot
    • Overview
    • Create contact form
    • Create lead capture form
    • Create customer survey
    • Prefill HubSpot form
    • Embed on HubSpot page
    • Uninstall
  • Zendesk
    • Create ticket form
    • Create CSAT survey
    • Embed on Help Center
    • Prefill ticket form
  • Admin
    • Users
    • Custom domain
    • Vanity subdomain
    • Subscription
  • Developers
    • Embed Library
    • API keys
    • API v1
    • API v2
  • Others
    • Partner program
    • GDPR compliance
    • Workflow logs
    • White labeling
    • Form speed
    • Zapier
    • Migration
  • Contact
  1. Help
  2. ›
    Features
  3. ›
    Conditional logic

Conditional Logic

On this page
  1. Introduction
  2. Practical examples
  3. Step-by-step guide
  4. Conditions
  5. Actions
  6. Advanced scenarios
  7. Important considerations
  8. FAQs

Introduction

Conditional logic is a powerful feature that transforms static forms into dynamic, interactive experiences. By implementing conditional logic, you can create forms that adapt to user input in real-time.

What is conditional logic?

Conditional logic is a set of rules that implement interactivity. Each rule (or step) has two parts: conditions and actions.

  • Conditions: Rules that evaluate user input
  • Actions: Changes to the form that occur when conditions are met

Here is an example of a support ticket form ↗ with conditional logic in place that shows a different set of fields based on the type of issue selected:

How a support form adapts based on user input
Conditional logic vs Workflows
Both conditional logic and workflows use conditions. The difference is that Workflows are used to trigger post-submit actions like sending emails or triggering an integration, while conditional logic is used to adapt the form as the user input changes.

Practical examples

Let’s explore some real-world applications:

  1. Support Ticket Routing
    • Condition: User selects "Technical Issue" as the problem type
    • Action: Show fields specific to technical support, like "Operating System" and "Browser Version"
  2. Event Registration
    • Condition: User selects "I need accommodation"
    • Action: Display additional fields for room preferences and special requirements
  3. Job Application
    • Condition: Applicant has less than 2 years of experience
    • Action: Show an optional field for explaining relevant projects or internships
  4. Customer Feedback
    • Condition: Customer rates service below 3 stars
    • Action: Display follow-up questions about specific areas of dissatisfaction
  5. Healthcare Appointment Forms
    • Condition: Patient selects Tele-medicine Consultation.
    • Action: Show fields for Video Call Preferences and Internet Connection Details.

Step-by-step guide

Follow these steps to access the conditional logic panel and set up rules for your form:

  1. Login ↗ to your Formcrafts account and open the form you want to edit, or create a new form using the Add form button.
  2. On the top-left corner of the form editor, click on Conditional Logic. This will open the conditional logic panel right below.
  3. Click on Add logic block to create a new rule. Each rule consists of conditions (to the left) and actions (to the right). Rules are evaluated from top to bottom, and in real-time as the user interacts with the form.

Let us now look at the two parts of a conditional logic step in detail.

Conditions

This is the first part of a conditional logic step.

Conditions are rules that determine if a particular action should be executed. These rules are being checked in real-time as the user input changes.

Conditional logic rule with highlighted a condition

Each condition has three segments. Let us look at them in detail, using the first example from the previous section:

If Enquiry type is Refund, show Company size field.

Fields

This is the field that the condition is based on. In the example, the field would be Enquiry type.

Operators

This is the operator that is used to compare the field value with the value you specify. In the example, the operator would be is.

The following operators are available:

  1. Is: Perform an exact match
  2. Is not: Exclude an exact match
  3. Is empty: Check if a field is empty
  4. Is not empty: Check if a field is not empty
  5. Is under: Check if a value is less than
  6. Is over: Check if a value is over
  7. Contains: Check if the field contains a part of another string

Value

This is the value that the field value is compared with. In the example, the value would be the string Refund.

The value can also be dynamic. You can type @ to reference other field values in the form.

For example, if you want to disable the form if the value of Email does not match the value of Confirm Email, you would use the following condition:

If Email is not Confirm email then disable form.

Actions

This is the second part of a conditional logic step.

Conditional logic rule with a highlighted 'show fields' action

Actions are what happens when the conditions are met. There are several types of actions available, which are discussed in detail below:

  1. Show fields
  2. Show steps
  3. Mark required
  4. Set value
  5. Set options
  6. Disable form

Show fields

Here is a key thing to remember when working with Show fields: By default all fields are visible. However, if certain fields are made visible using conditional logic those fields will be hidden on form load. They are only made visible when those conditions are met.

Examples:

  1. If Service Rating is less than 3 stars, show fields What went wrong and Suggestions for Improvement.
  2. If Attendee Type is Student, show the field University Name
  3. If Attendee Type is Professional, show fields Company Name and Job Title.
Showing fields based on user input

Show steps

The same applies to Show steps: By default all form steps are visible. However, if certain steps are made visible using conditional logic those steps will be hidden on form load. They are only made visible when those conditions are met.

  1. If Do you have previous work experience? is Yes, show step Work Experience Details.
  2. If Type of loan is Mortgage, show step Property Information.
  3. If Type of loan is Personal loan, show step Financial Information.
Showing steps based on user input

Mark required

This action allows you to make a field required based on specified conditions.

Example:

  1. If Subscribe to newsletter is Checked, mark required Your email address.
Making a field required based on user input

Set value

This action allows you to set the value of a hidden field.

Example:

  1. If Overall experience is Dissatisfied and Service quality is Poor, set value of hidden field follow_up to Yes.
  2. If Total order amount is over 500 and Have you ordered from us before? is No, set value of hidden field discount_percent to 15.
Setting a hidden field's value based on user input

Set options

This action allows you to change the available options for a dropdown or checkbox field.

Example:

  1. If Program type is Graduate, set options of Department to Agriculture, Resources, and Computer Science.
  2. If Program type is Undergraduate, set options of Department to Math, Computer Science, Environment, and Biology.
Changing field options based on user input

Disable form

This action allows you to disable the form.

Example:

  1. If Event date is less than 0 then disable form.
  2. If Are you over 18? is No then disable form and show field Error message.

Note: Event date being less than 0 means that the event date is in the past. See more below.

Disabling the form (and showing an error) based on user input

Advanced scenarios

Chained / nested logic

Fields that are made visible using conditional logic can also be used in other conditions. Think of these as nested dependent fields. This is best explained with an example:

  1. User selects product category
  2. Based on category, show relevant subcategories
  3. Based on subcategory, display specific product options
  4. If a specific product option is selected, show additional fields

At this point if the user changes the product category, the subcategories and product options would automatically update based on the new selection.

Condition groups

You can evaluate your condition as AND or OR.

  • AND: All conditions in the group must be true for the actions to be executed.
  • OR: At least one condition in the group must be true for the actions to be executed.

There are some cases where you might want to use a combination of AND and OR to create complex conditions. Some form builders, like Formcrafts, allow you to nest conditions to create complex logic. We call them condition groups. Each group can choose between AND and OR for its conditions, and the groups as a whole can be AND or OR.

We have a loan application form which contains a hidden field labelled pre-qualified. We use logic to set the value of this field to true if certain conditions are met. The conditions are:

  • Credit score is above 750 OR Income is above 100,000
  • AND Outstanding Debts = None
Highlighted condition groups in a conditional logic step
Conditional groups for advanced scenarios

Important considerations

Conditional logic in Formcrafts

In Formcrafts, the conditional logic panel can be accessed on the form editor page by clicking on the Conditional logic button in the top left corner. This will open a panel on the right side of the screen where you can add, edit, and delete conditions.

Conditional logic panel in Formcrafts
Conditional logic panel in Formcrafts

Address field

The address field contains multiple components, like street, city, state, and country. You can use the address field in conditional logic, but you have to reference the specific component you want to use.

The default address component, (like Your address) represents the full address, such as: 100 Queen Street West, Toronto, ON, M5H 2N2, CA

If you want to use the country component, it would be Your address (Country).

Conditional logic rule with address component
Using conditional logic with address components

Learn more about the address field ↗.

Working with dates

You have to enter a date in the format YYYY-MM-DD when working with dates. Example:

If Date is under 2024-01-01 then disable form.

However, you can also use dates relative to today. Today is represented by 0. Seven days from today is represented by 7. Five days before today is represented by -5. Example:

If Date is under -5 then disable form.

This would disable the form if the date is 5 or more days before today.

Table entry field

Table entry fields allow you to add multiple rows of data. Currently it is not possible to use the value of a table entry field in conditional logic. However, you can use this field in actions.

Example, you can show the table entry field if a certain condition is met.

Conditional logic vs Skip logic

Conditional logic is often confused with skip logic. Skip logic is a simpler form of conditional logic where you skip to a different part of the form based on user input. Skip logic is meant to control the user journey, with respect to the form steps they see.

Skip logic (offered by companies like Typeform ↗) is also sometimes called branch logic. Note that implementations of skip logic differ by provider, and some may offer more features.

Some other differences between conditional logic and skip logic:

  • Skip logic shows or hides entire form steps, while conditional logic can show or hide individual fields or form steps.
  • Conditional logic has a wider range of actions, including setting field values and changing field options.
Flow chart showing user journey with skip logic
User journey with skip logic

FAQs

Can conditional logic be used to show custom messages?

Yes, you can use the Rich Text field to add a custom message to your form. You can then use conditional logic to show or hide the Rich Text field based on user input.

Does using conditional logic affect the performance of my form?

Formcrafts' conditional logic is very performant, and has been tested to work with hundreds of condition sets. However, we generally recommend people to stick with less than 50 rules, or 100 rules for complex forms. While it won't affect the performance, managing rules over 100 becomes more difficult.

Can conditional logic be integrated with calculations in form fields?

Absolutely! This can be achieved using hidden fields. Hidden fields can contain math formulas, which are computed in real-time. You can use conditional logic on such hidden fields.

Let's say you want to impose a minimum order value. You have a hidden field which calculates the order total. You can then also have a conditional logic step which disables the form, and shows an error message if this hidden field is less than 100.

Minimal, fast, and powerful. Try now.
Formcrafts - a form and survey platform for Salesforce, HubSpot, etc

Subtle Web Inc,
225 Railway St E,
T4C 2C3, Cochrane AB

Salesforce AppExchange partner logo HubSpot app partner logo
Templates
Application formsLead generation formsSurvey & feedback formsEvaluation formsSupport request formsBooking & registrationContact forms
Comparisons
vs AllFormAssemblyTypeformJotformWufooSurveyMonkey
Features
Conditional logicSalesforce formsHubSpot formsZendesk ticket formsEmail formsIntegrationsForm fields
Resources
Help centerBlogDeveloper APIGDPRStatusReport abuseContact us
Company
About usNonprofitCase studiesSecurityTerms and privacy