How to use Conditional Logic correctly on Form pages, sections and fields
Forms are composed of Pages, Sections and Fields. There are times when you don't want them all to show up on every form.
For example - a re-enrollment form. Is your family returning?
If yes, you have to pay the re-enrollment fee and answer a few pages of questions.
If no, then you may ask "Why aren't you returning?" You don't want to charge someone who isn't coming back and you don't want to ask "Why aren't you returning?" to someone who is returning.
Therefore, you need to use Conditional Logic.
If you answer Yes - you will be charged the $200 and list the names of returning students.
If you answer No - you may answer one more question, but you're done with the form.
Use Conditional Logic when you want a "Condition" to determine whether or not a data field appears.
The admin sets the Condition on the Advanced tab of a Page, Section or Field.
- Enable Conditional Logic Checkbox - check the box for any Page, Section, Field (when editing a form, a Page, Section and Field are all considered Fields) that you want to be conditional.
- Set the Result - Show or Hide this Field
- All or Any - Do all of the Conditions below need to be met or just any of them? Choosing All will give you an AND between each condition. "My children are returning next year" AND "We are adding another student." Choosing Any will give you an OR between each condition. "I would like to volunteer to help with recess" OR "I would like to volunteer to help with lunch"
- Select the field used to determine the Condition - "Will you be returning..." The field used often asks a Yes/No question, but it could be a field that allows you to choose from several options.
- is/is not - select which applies. "is" is the default.
- Logic Statement - the options here are based on the field you chose in step 4. See below section on Logic Choices
- Select the appropriate answer to the Logic Statement you have now built. Yes, No or one of the choices
An Example of using "any" with two conditions separated by an OR.
An example of using a Radio Button field to determine the conditions. In this case, the Volunteer Opportunities field is shown if either of the first two choices are selected in the Program Selection field, but not if the third choice is selected.
Notice that a field that has Conditional Logic enabled has a purple eye in the upper right corner.
...on Pages and Sections
Pages and Sections are handled with Conditional Logic in the same way as a field is handled in the above examples.
An example using sections - if you would like to gather information about all of the students in a family on one Family Form, you can use Conditional Logic to only prompt Guardians to complete sections of a form based on their number of students. Conditional Logic enables users to only complete sections of forms that pertain to them.
In the above example the form requires 5 entries per student. The admin could have put conditional logic on every field, but it was much more efficient to create a section for each student that contains the five fields. This also allows the admin to create the section for Student One and then duplicate the section for each subsequent student. Big time savor. Once the sections are all created, the admin put conditional logic on the section.
The "Student Two" section is only displayed if the family has more than 1 student. You'll notice the condition is "greater than 1" student because you want student two to show up with any number of students more than one. If the family has 3 or 4 students, you still want student two to show up, hence the "greater than."
The condition is based on a "number" type field called "How many additional students are you adding?" The guardian enters a number in the blank field. The admin has limited the min value to 1 so that the guardian can not enter zero. The field is required. Finally the admin set "Allow Decimals?" to No so that only integers could be entered (no 2.5 kids).
Condition Logic on Pages works the same way.
Example - On a re-enrollment form, you don't want a family not returning to read/review/sign the school policy page. So, you add conditional logic to the entire page to hide it if they're not returning. The key here is to select the page by clicking on the tab/page you want to hide. Notice in the below image that the Field Type says "Page." The Advanced tab sets up the Conditional Logic exactly the same as Fields and Sections.
Additional Examples when you could use Conditional Logic
- Medical questions - Does your child have a Medical Condition? If they say yes, follow up questions can appear.
- Tuition Payment Plan - if you would like the admin to set the Payment Plan for each family's tuition, you could have a radio button field for them to choose the Payment Option (monthly, quarterly, one time payment) and then add a Conditional Logic field to ask if for their preferred payment method (cash, check, online) if they choose monthly or quarterly.
- Hot Lunch Form - you allow students to choose hamburgers or pizza and then Conditional Logic if they choose pizza - pepperoni or cheese.
If you delete a field that a conditional logic was linked to (the question or choice field), it will break a form. Make sure to remove the conditional logic from the connecting field before deleting.
Logic Choices
Conditional Logic is made up of Conditions and Logic. Makes sense right? You can add one or more conditions to a field that will determine if the field is visible/hidden and editable by the user filling out the form. The condition is made of one or more logic statements. "If this is true, then show the field" infers that "If this is false, then do not show the field."
You can also add multiple conditions such as "If this is true AND that is true." An example would be "If a student is in Kindergarten OR 1st Grade OR 2nd Grade OR 3rd Grade OR 4th Grade OR 5th Grade THEN they should fill out this field that is only for Elementary students."
As you enter a Conditional Logic statement you have several Logic option described below. The Logic Choices are based on the field type you use for your condition. The Field Type options are Text, Number, Yes/No, Checkboxes or Radio Buttons.
Yes/No | equal to | containing | starting with | ending with | empty | less than | greater than | |
Text |
x | x | x | x | ||||
Number | x | x | x | x | ||||
Yes/No | x | |||||||
Checkboxes |
x | x | x | x | ||||
Radio Buttons | x |
- equal to - a perfect match of the response to the question and one or more options you've selected. "Lunch choice is equal to Pizza," "Academic Level is not equal to 1st Grade OR 2nd Grade."
- containing - a somewhat fuzzy match. "Lunch choice is containing burger" would display the field if they chose "hamburger" or "cheeseburger."
- starting with - "Lunch choice is starting with ham" would display the field if they chose "hamburger" or "ham sandwich."
- ending with - similar to "starting with"
- empty - "Student prior schools is not empty" would display a field if the parent entered any number of prior schools in the field "How many prior schools has the student attended?"
- less than - "Number of children is less than 2"
- greater than - "Number of children is greater than 1"
Re-enrollment Form Example
The form excerpt you can see below has a field and two sections that use Conditional Logic. You know they are Conditional Logic fields because of the Purple Eye in the upper right corner of the field. They will only display to the Guardian filling out the form with a "Yes" answer to a previous question asked.
- The field "Will you be continuing at BLANK school for the...School year?" is a Yes/No field.
- The field "Would you like to add any additional students to your enrollment?" is also a Yes/No field, but it uses Conditional Logic and only appears to the Guardian if they answer "Yes" to the previous question.
- The Continuing Student section uses Conditional Logic and will only appear with a "Yes" answer to "Will you be continuing at BLANK school for the...School year?"
- The Student Two section uses Conditional Logic and will only appear if the "How many students are you re-enrolling?" has a greater than 1 student number entered.
Conditional Logic for "Would you like to add any additional students to your enrollment?"
Conditional Logic for "Continuing Students" section.
Conditional Logic for "Student Two" section.
Testing your Conditional Logic
Conditional Logic is powerful and very helpful, but it's not uncommon to make an error when setting it up. We recommend to test the form by using the Preview feature and test out each conditional logic statement. Make sure to test the positive and negative options for each Conditional Logic.
If you have trouble saving a form while editing or you get an error when testing the form, DO NOT delete everything, cancel your edits or refresh the page. There is likely an error with the Conditional Logic. Delete one Conditional Logic field at a time and try to save the form. If Save works, you've found the error. If Save still doesn't work, then click the Redo button to put the field back and try a different one. By doing this one at a time, you will save a lot of time and effort.