# Conditional Logic







Conditional logic controls how people move through your form. You decide which
step comes next, when a response counts as completed, and when to stop someone
continuing.

<Frame>
    <img alt="Conditional Logic Interface" src="__img0" />
</Frame>

## Open the Logic Tab [#open-the-logic-tab]

1. Navigate to your form in the Surface editor.
2. At the top, click on the **Logic** tab.
3. Select the step you want to configure.

### 1. Change the Default Next Step [#1-change-the-default-next-step]

By default, each step flows to the next one in order. To change that:

1. Select a step (e.g., step0).
2. In the right-hand panel, open the **Default next step** dropdown.
3. Choose which step should follow.

### 2. Mark a Step as a Completion Step [#2-mark-a-step-as-a-completion-step]

A **Completion Step** ends the form once the user reaches it.

* Toggle on **Completion Step** in the right-hand panel.
* When a user lands on this step, their response is marked as **Completed**, and workflows tied to completions will run.

Use this for your final **Thank You** or **Confirmation** screens.

### 3. Mark a Step as an Invalid Step [#3-mark-a-step-as-an-invalid-step]

An **Invalid Step** blocks the user from progressing further.

* Toggle on **Invalid Step** in the right-hand panel.
* When a user lands here, their response is marked as **Invalid**.
* Invalid responses will **not trigger workflows** and the user cannot move forward.

Use it to filter out unqualified leads, or to handle incorrect inputs.

## Advanced Routing (Routing Rules) [#advanced-routing-routing-rules]

Advanced Routing sends people to different steps based on their answers,
instead of a fixed linear flow.

### What You Can Do with Advanced Routing [#what-you-can-do-with-advanced-routing]

1. **Add Conditions**: define rules that check user inputs (e.g., email, company size, budget, etc.).
2. **Use Form Response Data**: conditions can be applied directly on responses collected in previous steps.

### Example [#example]

<Frame>
    <img alt="Advanced Routing Example" src="__img1" />
</Frame>

To skip certain people straight to the end of the form based on their email
address:

* **Condition**: If the email entered in **Step 0** equals [saharsh@withsurface.com](mailto:saharsh@withsurface.com)
* **Action**: Jump to **Step 2** (Thank you step)
* **Else**: Default path continues to **Step 1**

<Tip>
  Combine multiple conditions with **AND** / **OR** logic to build branching
  flows.
</Tip>
