Skip to main content

Conditional logic and branching

Updated this week

Conditional logic enables you to create dynamic form paths that guide respondents to relevant questions based on their responses. Respondents never have to skip irrelevant questions — because with display logic, they’ll never even see them.

Conditional logic is available for free to all Formly users.

How to create logic

1. Open form from your Dashboard and go to Logic tab (Display Logic will be selected as a default)

2. Click on Display Logic and then + Add Logic

3. Select the question and appropriate condition.


After adding a conditional logic block to your form, you can select from three types of actions to trigger. You’ll find them in the Then dropdown:

Show

In the example below, Q2 and Q3 will be shown when the Respondent selects Yes in Q1.

Newsletter Preferences Form

Q1. Would you like to customize your newsletter topics?

  • Yes

  • No


Q2. What topics are you interested in?
(Multiple choice: Marketing, Tech News, Product Updates)


Q3. How often would you like to receive emails?

  • Weekly

  • Monthly

Conditional Logic: If Q1 = Yes → SHOW Q2 and Q3

Click ⠇next to the logic block to add new condition, remove, or duplicate.

If you set Show logic then the question will be hidden by default and it is only shown when the condition is met.

If you use Show logic, the question will appear in its original position in the form — it won’t skip ahead.

If you want the respondent to go directly to a specific question, use Jump to instead.

Pro Tip! Change form settings to "Single Page Layout" while testing so it's easier to check the logic.


Below, you can try out the form we built in this guide:

Newsletter Preferences Form - https://getformly.app/Xl4SvQ

Hide

In the example below, Q2 will be shown by default but when the Respondent selects No in Q1 then Q2 gets hidden.

Event Registration Form

Q1. Will you attend the event in person?

  • Yes

  • No

Q2. Please select your dietary preferences (for catering):
(Multiple choice: visible by default)

  • Vegetarian

  • Vegan

  • Gluten-Free

  • Halal

  • No preference

Conditional Logic: If Q1 = No → HIDE Q2

If you set Hide logic then the question will be shown by default and it is only hidden when the condition is met.

Pro Tip! Change form settings to "Single Page Layout" while testing so it's easier to check the logic.

Below, you can try out the form we built in this guide:

Event Registration Form - https://getformly.app/ltzBTL

Jump to

In the example below, If Q1 = Website Navigation → JUMP to Q4 Otherwise → Continue to Q2

Service Feedback Form

Q1. What service did you use?

  • Technical Support

  • Billing

  • Website Navigation

Q2. How satisfied were you with the support agent?

  • Very satisfied

  • Neutral

  • Unsatisfied

Q3. What could we improve?

Q4. What part of the website was confusing?

  • Homepage

  • Login

  • Checkout

Conditional Logic:
If Q1 = Website Navigation → JUMP to Q4
Otherwise → Continue to Q2

Note 1 - Jump to option only works with the Slides Layout (one question per page). It won’t work in the Single Page Layout (all questions on one page).

Note 2 - Jump to option only works when the IF condition is based on a question. It doesn’t work with Variables — use the Show option instead.

Below, you can try out the form we built in this guide:

Service Feedback Form - https://getformly.app/AyDPZ3

4. Click Save to set the display logic for your form.

Here are more examples of when to use Logic:


Test your form

Before sending your form to respondents, test different scenarios by selecting different answer options each time.

Did this answer your question?