Handlebars - Basic Question References


Handlebars is a templating language that can be used to reference answers from a form submission. These references can be embedded within HTML, or whatever language you are using to define how a document should be structured.

It is used with the following features:

In this document, you will read about how to reference single answers to questions, wherever they are in the form.

Read about Handlebars: Advanced Question References if you are interested in building more dynamic document templates that don't require you to reference every question individually.

Referencing the Answer to a Question

A basic reference can be used in most cases where you are mapping a single answer from a form into a document. In these cases, you do not need to understand the full structure of a form, and you move the questions to different pages or sections in the form without affecting the document. 

If you are building a custom PDF, Word, or HTML Document using Handlebars, the first part under Reference Data in the document editor screen will show you which questions you can reference.

Example Form

This is a sample describing the basic data structure of a form. (Highlighting added for the purposes of documentation).

  • All questions in the form are wrapped in the "Answers" node (shown here in orange)
  • The parts highlighted in blue here are the questions, followed by a sample answer
    • The question reference shown here is based on the Unique ID, with any spaces or special characters removed

Example Handlebars Reference

You can have the answer to "AccountName" printed in your document using the following reference:



ABC Construction

How does it work?

The final part of the reference (after the last ".") is what will get printed in the document; everything before it tells the document what path to follow through the data structure in order to find it.

The reference above tells the document to:

  • Look for the "answers" node
  • Look for "AccountName" inside of it
  • Look inside of AccountName, for the first value wrapped in square brackets

Referencing Many Questions Efficiently (using "#with")

If you are referencing many questions, you can save yourself a bit of typing. You can do this by using the Handlebars "with" helper.

Example Reference

Instead of referencing multiple questions like:


You can do this:

{{#with answers}}


Jane Doe
123 Avenue Street
New York

How does it work?

The #with helper tells the document to look inside of "answers" for every reference that comes after it, until it hits the closing /with.

Questions with Multiple Properties

Answers with certain data types have multiple properties. The properties either combine together to provide a full answer to a question, or the properties contain multiple ways to reference the same answer (for example, a date/time question will contain the same date/time shifted into some different timezones.

When an answer has multiple properties, you can choose which of these properties you want to be used in your document.

Example Form

This form has two questions. 

  • The first is a Date, which only has one answer. 
  • The second is a Duration, which has two properties (in this case, they display the same answer, but in different units - milliseconds, or hours/minutes/seconds).

Example Handlebars Reference 




Image/Sketchpad/Signature Questions

Photos, Sketches, and Signatures are other types of questions that have multiple properties. Because they can be a little difficult to reference, it's easiest to use our custom Handlebars helper for images.

Questions that allow a Single Image, Sketch or Signature

For Signature questions, or Image/Sketchpad questions set up to allow only one image, you can get the image to print out with the following reference. Specify the height OR width, and images will auto-scale to maintain proportions, whether they were taken portrait or landscape.

Info:We’re now TrueContext.
 {{pf:img answers.PhotoUniqueID.[0] height=200}}

Questions that allow Multiple Images or Sketches

Image or Sketchpad Questions can be set up to allow multiple images. To print all collected images, use the following reference. 

{{#each answers.PhotoUniqueID}}
{{pf:img this height=200}}