(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.
If a regular section contains a number of questions you would like to print out with exactly the same formatting, it can be most efficient to loop through them, rather than referencing each question individually.
We will print out the below example into a document from a Regular Section.
Here is a form with a Regular Section, named Common Area. 3 questions with Pass/Fail answers are shown (but the section can have many more and this example would still work).
HTML and Handlebars Example:
We will "loop" through all the answers in the section, printing each question/answer pair as a table row.
Note: This example works for questions with simple, single property answers, like text fields or dropdowns. Refer to our Basic References article to learn about referencing questions with other data types -- for example, photos need to have their "values" printed out in a specific way.
Document Output Example:
How does it work?
The #each helper tells the document, for each question inside of "answers" in the CommonArea section, to print out a table row containing the two cells with the question text and the question answer. When it is done with one "answer", it loops back and starts work on the next one, until all questions in the section have been printed.