Introduction to Logic Expressions
Logical expressions evaluate respondent answers to return a boolean result (true or false). In Accessible Surveys, these expressions are primarily used to dynamically show or hide pages, sections, or questions.
Basic Syntax & Hidden-When-True Rule
Expressions evaluate respondent answers in real time against defined conditions:
Hidden-When-True Rule
In Accessible Surveys, visibility conditions are evaluated in the logic.hidden slot:
- When an expression evaluates to
true, the element is HIDDEN. - When an expression evaluates to
false(or is empty), the element is VISIBLE.
Always write the condition that should cause the item to disappear.
Binding Survey Fields
To evaluate a respondent's answer within your logical expression, you must bind the question or choice option as a variable.
In the survey builder, drag and drop items from the structure tree directly into the expression editor:
- For text, numeric, date, or scale questions: Drag and drop the question item itself into the expression field.
- For choice questions (radio, checkbox, dropdown): Expand the question in the tree and drag and drop the specific Option to the right of the comparison operator.

Examples
1. Show a question only when an answer is provided
To show a follow-up question only after the respondent answers "What is your name?", configure the follow-up question to be hidden when the name field is empty:
`What is your name?` == ""- When empty,
"" == ""evaluates totrue→ the follow-up question is hidden. - As soon as the respondent types a name,
name == ""evaluates tofalse→ the question becomes visible.
2. Show a question only when an answer contains a specific word
To show a question only when the response to "What is your favorite fruit?" contains the word "apple", hide it when "apple" is absent:
!("apple" in `What is your favorite fruit?`)- If the respondent enters "orange", the condition evaluates to
true→ the question is hidden. - If the respondent enters "green apples", the condition evaluates to
false→ the question becomes visible.
3. Show a question only when a specific option is selected
To show a follow-up question only when "Do you like fruit?" is answered with "Yes", hide it when the selection is anything other than "Yes":
- Drag the question
Do you like fruit?into the expression field. - Enter the inequality operator
!=. - Drag the choice option
Yesto the right of the operator:
`Do you like fruit?` != `Yes`- While unanswered or answered with "No", the expression is
true→ the question is hidden. - When the respondent selects "Yes", the expression evaluates to
false→ the question becomes visible.
Operators and Canonical Syntax
Accessible Surveys uses Jexl syntax. For the complete, canonical reference of all comparison operators, logical operators, math functions, and transforms, see the Jexl Syntax Reference.
Related Content
- Jexl Syntax Reference — Comprehensive operator reference
- Advanced Logic Expressions — Multi-condition formulas and transforms
- Understanding Form Logic Explanation — Conceptual background on expression evaluation