Conditional statements allow you to display sections in a form when certain conditions are met. For example, if you want to change the flow of the form depending on what answer the user provides.
Conditional statements work with 'yes/no', 'multiple choice' and 'checkbox' widgets. The widget that can appear or disappear depending on the answers provided is a 'section' widget. Please read through the steps and see an example form below.
Step 1
In 'advanced settings' for the widget assign a variable name. The name is a memorable string. No spaces are allowed. Examples:
If the 'yes/no' question is "are you a UK resident", you may want to call the widget "UK_resident".
In a multiple choice question "Which country do you come from" the answers may be "UK", "Poland", "Germany", "Other". The variable name may be "Country".
In a checkboxes question "Which products are you interested in", the answers may be "Annual report", "VAT", "Bookkeeping". The variable name may be "Product".
Step 2
Add sections which are supposed to appear when a certain answer is provided.
Step 3
Match the sections with appropriate answers. Go to advanced settings of each section. In the conditional statement field (in advanced settings) write the condition. The way you write the condition depends on the type of widget the answer is coming from:
For yes/no widgets the condition should be: variable_name==true or variable_name==false; For example UK_resident==true. Please note that double equals sign designates equality.
For multiple choice widgets, a variable is an object with properties "text" and "index".
For example: Country.text == "UK" || Country.index == 0
Referring to the example 2 above if the condition is "Country chosen is Poland" the condition would be Country.text=="Poland". If the condition is "Third option was chosen", the condition would be Country.index == 2
For checkboxes you need to list the choices you are interested in; Referring to example 3 above
If the variable name is Product, the first choice would be Product[0], the second choice would be Product[1] and so on.
If the condition is "VAT was chosen", the condition you write would be Product[1]==true.
If the condition is "Annual report OR VAT was chosen" the condition would be Product[0]==true || Product[1]==true. Please note that || sign means "or"
If the condition is "Annual report AND VAT was chosen" the condition would be Product[0]==true && Product[1]==true. Please note that && sign means that both statements must be true for the condition to be true (logical "and").
Example form:
Note that the conditional statements can work with more complex structures. For example:
where conditional statements refer to variables that are embedded in sections. In this case you need to make sure that you add a variable name to each section that holds the source variable and that you reference the full 'path' of the variable in the conditional statement (ex. SectionName.VariableName)
where conditional statements refer to variables that are embedded in other forms. In this case a similar rule applies as above, i.e. the form itself needs to be assigned a variable and that form needs to reside in the correct 'space'.






