Creating a conditional confirmation page or confirmation email for your LGL form

In this article:

IMPORTANT NOTE: If you have programming experience or access to a programmer, you can use the liquid templating language to create conditional confirmation pages or emails in LGL Forms. Please be aware that creating the conditional confirmations themselves is not a service that Little Green Light provides.

When to use a conditional confirmation page or confirmation email

Only one confirmation page or email can be defined in LGL Forms for any given form, but in some cases you may want to provide multiple versions of a confirmation message for a single form.

Using conditional logic within your confirmation page or confirmation email allows you to configure, to a limited degree, when a specific message for your form will sent to the user. 

When you've created the conditional logic so that it works as expected, you'll then add it to your confirmation page or confirmation email within the Confirmation options for your form.

For the Confirmation page, the conditional logic goes in the Confirmation page text pane:

For the confirmation email, the conditional logic goes in the Content pane:

Understanding conditional logic

Typically, you will add two message options for your confirmation page or confirmation email, using conditional logic to define when one message or the other should be sent.

Say, for example, that you want to be able to send a confirmation email for a one-time donation that is different from a confirmation email for a recurring donation.

For a form that supports both recurring donations and one-time donations, you can use the following logic: 

{% if is_recurring == 'Yes' %}
If this is a recurring donation form, then put a custom message to recurring donors here
{% else %}
Thank you for your one-time donation.
{% endif %}

NOTE: Using conditional logic is possible because confirmation pages and emails include support for the Liquid Templating language, developed by Shopify. (Specifically, this section of the Shopify documentation is probably the most useful: Control flow.) You can use the full range of liquid syntax as defined in the document, but most commonly simple if/else statements should do the job.

Customizing your text in the conditional logic

When building conditional messages, we recommend using the following approach: 

1. Create a submission (without paying, if your form accepts payments)

2. From the Submissions page, click the "View confirmation page" link for your submission. If you're testing an unpaid transaction, you'll see the View confirmation page option:

3. In a new tab in your web browser, go to the Confirmation Page tab and work on your logic within it (we recommend this because it's easy to preview your page by making your changes in the other tab, saving, and toggling back to the confirmation page to view them, but it's not as easy to preview a confirmation email)

4. Return to the confirmation page (from step 2) and refresh your browser to view how the text looks

5. Repeat this process until the message displays the way that you want. If you're sending an email confirmation, you can then copy the confirmation page content into the confirmation email's  Content pane:

Please remember to save your changes, and note that you can also send a test email from here:

Tips for troubleshooting your conditional logic

If your conditional logic is not working as expected, please follow these tips to troubleshoot the issues:

  1. Be sure that your values are exactly right, and they are coming through: For example, "equals" is case-sensitive, so you have to be careful and make sure the casing in your statement is exactly the same as the value you're matching to. You may also have trouble with extra spaces, so make sure none are present. The "contains" option might be a better one to use, in some cases.
  2. View the source and make sure that there are no HTML tags or entities anywhere in the logic.
  3. It's usually easiest to test your logic on the Confirmation page. Once you have that working, copy the same logic to the confirmation email.