(Please note that older articles might not render correctly in mobile view.)
Note: This feature is a limited release for clients using Version 2 forms.
This article is about using Handlebars to reference questions in custom PDF, Word, and HTML documents. We recommend reading about Basic Question References and Advanced Question References before trying this.
Repeatable sections allow you to add multiple entries for the same set of questions, as many times as a user needs to. In documents, Repeatable sections are typically printed out in a table. This article explains how to do this most efficiently.
We will print out the below example into a document from a simple Repeatable Section.
Here is a form with a Repeatable Section (which collects Today's Date, and the Hours Worked). Only one entry to the repeatable section is shown here to save on space.
One "row" in the above data structure is one repeatable section entry. You will want to loop through the rows to print them all. In the example below, we will print each "row" in the repeatable section into its own row in the table. This will work whether you enter 1 or 30 entries into the repeatable section.
HTML and Handlebars Example:
Document Output Example:
How does it work?
The #each helper tells the document, for each "row" that it finds in the Repeatable section, to print out a table row containing the two cells with the question references. When it is done with one "row", it loops back and starts work on the next row, until all rows have been printed.