Conditional Forms
Learn how to build a conditional form.
Conditional Forms include all the features of Basic Forms but are enhanced with advanced functionalities like Step Logic, Section Logic and Dropdown option filtering (based on logic). These features enable the forms to adapt in real time to the attributes or input of your form users, creating a tailored form-filling experience.
Building a Conditional Form
Setting up a Conditional Form involves the same initial steps as setting up a Basic Form. Here’s a quick recap:
- Add a form block preset: From your Softr app, add a new form block to your page.
- Select a destination: A destination can be a data source, email or a tool like Zapier or Make.
- Add questions: Add and map the required fields into your form such as Name, Email, Message, etc.
Step logic
Step logic allows you to guide users through specific steps of a form based on their inputs or predefined user attributes. Here’s how to implement it:
- Add steps: Break your form into multiple steps or pages.
- Set conditions for paths after a step: Specify conditions under which a user should be directed to a particular step. For example, if a user selects "Yes" to needing additional services, you can set the form to navigate to a step that gathers more detailed information about their requirements.
- Test step logic using preview mode: Ensure that each pathway functions as intended by testing each conditional route to catch any errors or logical inconsistencies.
Section logic
Section logic enhances the adaptability of forms within individual steps:
- Add sections: Divide your form into sections within a single step, grouping related fields together.
- Apply conditions to sections: Configure each section to show or hide based on user responses or attributes. For example, a section asking for payment information can be hidden unless the user selects a paid service.
- Dynamic sections: You can make sections dynamically appear as more information is required or certain conditions are met, improving form engagement and preventing information overload.
Dropdown options filtering
Dropdown options filtering allows you to conditionally display specific values in a dropdown field based on certain criteria. This is particularly useful when you want to guide users to select only relevant options.
Linked record option filtering
Imagine you have an event registration form connected to your "Registrations" table, which in turn is linked to an "Events" table. Each event in your data source might have a status of either 'Upcoming' or 'Past'. To prevent users from registering for 'Past' events, you can filter the dropdown to only show 'Upcoming' events. Here’s how to set it up:
- Add the dropdown field: Insert a dropdown field in your form and map it to the 'Event' field, which is a linked field from the "Registrations" table.
- Access the option filter: Click on the logic icon next to the “Options” label. This will open the option filter panel.
- Apply the conditional filter: Toggle on the "Filter options by condition" setting and add a condition. For this example, you’ll filter by
Status is Upcoming
.
With this setup, the dropdown will only display 'Upcoming' events for users to select, ensuring that they can’t mistakenly register for past events.
This example demonstrates how to filter linked record options.
Option value filtering
You can also apply filters based on the option values themselves, providing flexibility for different scenarios. For instance, imagine you have an email field in your data source that’s mapped to a dropdown field. If you only want to display email addresses that belong to a specific domain, such as '@softr.io', you can filter the dropdown options to show only those emails. This ensures that users are restricted to selecting emails that match the specified criteria.
Ending Logic
You can control what happens when a user submits the form based on conditional logic. There are two parts to setting conditional endings: the ending itself and how users arrive there. One ending is always provided for you by default and you must have at least 1 ending on every form.
To access the Endings, select the form block and click on the Questions tab.
The Form Ending
- On Submit - You can choose to either show a success message or a thank you screen. For success message you can customize what it says. For the thank you screen you can customize what the thank you popup modal says.
- Success Message/Thank You Screen - This section will change based on your choice, allowing you to change the success message or thank you screen respectively.
- Action - Here you can choose what should happen when the user submits the form. Choose from the following options:
- Refresh form - This will start the form from the beginning and let the user start a new submission
- Open details page - This will open a details page for the newly created record. If one doesn’t exist, you can create one.
- Open page - This will open a page in your app that you specify.
- Open external URL - This will send the user to a link or URL that you specify.
- + Add ending - This will add another ending to your form that you can use conditional logic to direct form submissions to.
Adjusting the Logic Much like adding steps to the conditional form, you can select steps and use paths to send users to different endings.
- Click on the Logic tab to open up the form Logic Builder.
- Select the Step you want to route to an ending.
- Apply any logic that should make this path function and choose the Ending you want.
Last updated on December 19, 2024