Logical conditions in email notification templates and form results

Good afternoon.

As you know we have a separate section "Logic", where you can customize different email notification templates and form results depending on the user's choice in the form. All this works fine, but sometimes you only need to replace one small part in the template and it would be much more convenient to write this condition right in the template instead of configuring different rules and changing the whole template completely.

This way, you can personalize each email to a user or output the results of a form according to a certain condition.

Until recently it was impossible to do that. But now you can customize your templates more flexibly.

How do I specify a condition in a template?

In order to configure a condition you need to have minimum programming skills and be able to use IF - ELSE - ENDIF.

The syntax will look like this:

{% if field1234 == "TEST" %}
    If field1234 macros is equal to TEST value, 
    you will see this text.
{% else %}
    Otherwise, this text will be displayed
{% endif %}

Control structures (if/elseif/else/endif) are inside {% ... %} of blocks.

In the IF construct, we prescribe an expression (condition) which will print the text that is written below. If the condition is not met and is an ELSE construct, the text written between ELSE and ENDIF will be output.

The ELSE construct is optional, but each condition must end with an ENDIF block.

{% if field1234 == "TEST" %}
    If field1234 macros is equal to TEST value, 
    you will see this text.
{% endif %}

Logical operators

You can combine expressions using the following operators:

  • and: Returns true, if the left and right values are true.
  • or: Returns true, if the left or right value is true.
  • not: Contrary to the value.
  • (expr): A group of expressions.
{% if field1234 == "TEST" or field1234 == "TEST2" %}
    If the macros field1234 is TEST or TEST2, 
    you will see this text.
{% endif %}
{% if field1234 == "TEST" and field2345 == "TEST2" %}
    If the macros field1234 is TEST and the macro field2345 is TEST2, 
    you will see this text.
{% endif %}

Comparison operators

The following comparison operators are supported in any expression: ==, !=, <, >, >=, and <=.

Content Operator

Operator in The in operator shall check for coincidence. It returns trueif the left value is contained in the right one:

{% if field1234 in ["TEST", "TEST2"] %}
    If the macros field1234 is TEST or TEST2, 
    you will see this text.
{% endif %}

Make your templates and form results more personalized, and increase the efficiency of your forms.

That's all for today. Have a good day!

Comments
Ready-made templates of web forms
Gold

Auto Value Estimation Quiz Template

Thanks to this quiz, you can find out the most important things about the car from the owner in a few minutes Details
Platinum

Plastic window calculator

With the help of plastic window calculator the user can calculate the cost of the chosen profile, double glazing and additional options. Details
Gold

Calculate delivery cost

Answer a few simple questions and get a rough estimate of the shipping cost of your shipment. Details
Gold

House construction calculator

This online calculator calculates the cost of a box house in various configurations and shows the price of erecting a house Details

Order turnkey form development

No time to figure out all the settings yourself? No problem!
Order web form development from us