How Display Logic Works
Display Logic operates using JavaScript expressions. A component will display if the expression evaluates as true and will remain hidden if it evaluates as false. You can apply this logic to individual components or entire sections, groups, or tiles on your form.
Let’s explore how this works with a real-world example: a Student Absence Reporting Form used by school districts. In this form, Display Logic can reveal specific fields based on the reason for the student’s absence. Check out the nearby animation to see this in action — it’ll quickly show you just how useful Display Logic can be!
Where to Find Display Logic
You can find the Display Logic settings in the Properties panel of any component that supports it. Simply click the Display Logic icon, and a Display Logic window will appear.
Writing Display Logic
Although this may look daunting at first, you have options to choose from! You can use Droplet AI to write display logic expressions, write your own expressions, or use our helper functions to make those expressions easier.
Let's dig into each of these three options in the sections that follow.
Droplet AI
Not sure how to write the right expression for your Display Logic? Droplet AI can help! It’s like having a Droplet Team Member embedded right within Droplet, ready to help you craft the perfect logic for your form.
To use Droplet AI:
Select your component and click on the Display Logic icon in the Properties panel.
In the pink-shaded box, type the conditions under which you want the component to display, using plain language. Press Enter.
You’ll see the resulting expression appear on the right side of the window. Press Done.
Save your form, then use the Debug feature to test and make sure the Display Logic is working as expected.
Frequently-Used Examples
Below are some super common examples of display logic in action:
Display a component when another component equals a specific value, such as showing additional questions when a parent selects “Sick” as the reason for absence.
We might write something like this as the display logic expression:
Display a component when a multi-select component (like a checkbox) includes a specific value. In our Student Absence Reporting Form example, you might include a checkbox component labeled “Select all that apply for additional details:” with options like “Medical Visit Required,” “Extended Absence,” and “Homework Request.”
If a parent selects Homework Request, we might want to ask additional questions about that. So, we'd use something like:
Display a component when another component doesn't equal a specific value, such as showing additional questions when a parent selects a school other than the high school.
We might write something like this as the display logic expression:
We often want to hide a component that only serves a calculation purpose and doesn’t need to be shown to the user, like Computed Component.
Use:
Display a component when another component has some response from the submitter. A really common example of this is when you want a timestamp to appear when a submitter has adopted their signature on the submission.
We can write:
Helper Functions
Droplet has a variety of shortcuts (called Helper Functions) to make writing Display Logic easier. Think of them like Google Sheets or Excel functions. We have a full guide of our helper functions at the link below:
What about Hidden Required Fields?
If a required field is hidden by Display Logic, it won’t be required. For example, if the Student Absence Reporting Form hides the doctor’s note field because the parent didn’t select “Sick,” that field won’t need to be filled out, even if it is required. In other words, only visible required fields will actually be required to submit the
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article