Skip to Content
ModulesDocxConditionals

Conditionals

Conditionals are used to create different content based on the value of a variable. An example of a conditional would be to check if an element has a value or not. This can be achieved writing the following code:

{#elements[‘KNzQfQy5uentPBnTL'].value} {elements['sdRvecSasGdq8XK45'].title} {elements['KNzQfQy5uentPBnTL'].title} {elements['KNzQfQy5uentPBnTL'].value} {/}

The {#} and {/} tags are used to start and end a conditional. The value between the tags will only be rendered if the condition is true.

Equality and inequality

You can also compare values using the == operator. For example:

{#elements['KNzQfQy5uentPBnTL'].value == 'Option 1'} The user selected option 1 {/}

The same can be achieved using the != operator:

{#elements['KNzQfQy5uentPBnTL'].value != 'Option 1'} The user did not select option 1 {/}

And / Or operators

You can combine multiple conditions using the && and || operators. For example:

{#elements['KNzQfQy5uentPBnTL'].value == 'Option 1' && elements['sdRvecSasGdq8XK45'].value == 'Option 2'} The user selected option 1 and option 2 {/}
{#elements['KNzQfQy5uentPBnTL'].value == 'Option 1' || elements['sdRvecSasGdq8XK45'].value == 'Option 2'} The user selected option 1 or option 2 {/}

Comparison operators

You can also compare values using the >, >=, < and <= operators. For example:

{#elements['KNzQfQy5uentPBnTL'].value > 10} The value of the element is greater than 10 {/}
Last updated on