Conditional Logic
Learn how the widget uses conditional logic to show or hide fields based on people's answers.
The widget can use conditional logic to show or hide fields depending on answers to earlier questions. This way, only relevant fields display as respondents work through a form.
For example, let's say you're gathering menu information for a new member luncheon, so you have your new members complete a form. On this form, one question asks "Do you have any food allergies?", and they can select either yes or no. If the respondent selects yes, a follow-up question displays to ask "What are your food allergies?" with an option for the respondent to answer. If the respondent selects no, the follow-up question does not display because that question is irrelevant since they already answered that they do not have any food allergies. This helps you gather the information you need without bombarding respondents with a million potentially irrelevant questions.
For a more in-depth understanding, check out the full example. Or, to learn how to add conditional logic, jump to the next section.
Example of Conditional Logic
In this example, you're recruiting volunteers for Dream Team, a community outreach initiative that delivers ice cream and runs a local shop. When people open the form, only one question displays:
Those who answer "Yes" are asked to share about where they currently serve and pick their preferred Dream Team position. This represents two form fields, both dependent on the same original form field:
Research and development is an advanced position, so respondents who select "R&D" will be asked about their Scoop Shop experience:
Those without Scoop Shop experience are encouraged to start in another position before applying to "R&D":
Those with Scoop Shop experience are then questioned about their culinary experience:
On the other hand, those who answered "No" to the very first question are presented with an entirely different set of form fields:
Add Conditional Logic
There are two ways to add conditional logic to your custom form: through the Form Editor tool or by updating the Form Field records after you create the form. Choose the method you feel most comfortable with.
- There is no limit to the number of dependencies that you can configure.
- Currently, you can only add conditional logic to the Radio Button Horizontal and Radio Button Vertical field types.
- If a required field is not shown based on conditional logic, it will not be required for that user.
Using the Tool
If you're creating a new form or updating an existing form to include conditional logic, you can use the Form Editor tool. Once you add a question and its options, click the button beside the relevant option. For example, if you want to show a question based on someone answering "Yes" to this question, click the button beside the Yes option.
Then, click the question that should depend on the selected value, and click Save. The tool does not show this change, but the Form Field record is immediately updated in the background. You can repeat this for each question that depends on the value, and each one will be saved. (So, if you want multiple questions to only show when an answer is selected, make sure to click the link chain button and complete the steps for each question.)
Using Form Field Records
If you've already created your form, you can update the associated Form Field records. There are two fields on the record that enable conditional logic:
- Depends On
- Select the form field that the current form field should depend on. The current form field will show or hide based on a respondent's answer to the form field you select here.
- Depends On Value
- Enter the exact field value that the respondent must choose for the "Depends On" form field in order for the current form field to display. Avoid extra spaces before or after this value to ensure proper display in the widget. Note: Fields you select for a Depends On Value must be part of the same form. If the Depends On Values are not part of the same form, your custom form will not work. Consider adding a sub-page view with the following view clause to help find Depends On Value discrepancies.
Form_Fields.Form_ID <> ISNULL(Depends_On_Table_Form_ID_Table.Form_ID, Form_Fields.Form_ID)
No Experience
Some Experience
Extensive ExperienceKeep in mind that each new line in the field values section represents a new radio button in the form: Multiple form fields can share the same values for the Depends On and Depends On Value fields. For example, if a volunteer indicates no experience, you can ask additional questions relevant to them. Each form field must be individually configured, even if they depend on the same initial question.