Using answers in templates

Personalize your flows by reusing answers you've collected.

Customized question labels

It is possible to substitute form answers in question or content labels, redirects, and many other places within a flow.

The syntax used to do this is similar to Mustache or Handlebars, if you're familiar with those.

If I have collected a variable called first_name, I can use it later in the flow by placing the variable within double curly braces:

Hello, {{first_name}}!

If the responder provided Susana as their first name, this label would render as:

Hello, Susana!

If you attempt to render a template when the variable is missing, the variable name will be shown within the flow.

Keep this in mind when designing flows. If you are displaying an answer back to a user on the same step on which you collect it, you should make that content conditional using the Is defined operator, so that the user does not see the {{variable}}.

Formsort prevents using variables in steps previous to where they are collected.

Content that can be templated

It's most common to personalize form content visible to the user, but Formsort allows the use of templated variables in a variety of contexts. Two are described below; there are many others.

Redirect URLs

Redirects allow the use of templates to create URLs based on the form answers.

For example, you might want to forward along some URL parameters that are present when the flow is loaded, such as utm_source to the place that the responder is ultimately redirected to. To do that,

  1. Add utm_source as an external answer, so that it is available within the answers.

  2. Use utm_source within a redirect's URL, such as{{utm_source}}

When the user is redirected, the value of the utm_source will be inlined into the URL and

Image URLs

Similar to redirect URLs, image URLs allow the use of templated answers.

For example, you could load an image based on a user's state:

  1. Collect an answer for the user's state within the flow, calling it something like state_code.

  2. Add an Image content block and set the URL to use the variable you defined, such as{{state_code}}.png.

Last updated