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.
About
Using Handlebars, you can have things in your PDF/Word/HTML documents displayed in different ways depending on a scenario. For example, you can display the way an answer is shown depending on what its answer is.
Format the Background Color of an Answer
It is a common request to "highlight" questions that have a certain answer, such as highlighting "Fail" answers Red and "Pass" answers Green. You can accomplish this by testing if the answer equals a certain value, and then using inline CSS formatting to change the background color based on this.
Handlebars and HTML Sample
<p> |
Example Document Output
How does it work?
The #ifeq helper references a question and tests if it equals a value. If it does, the string of text (the color hex code) that comes before the closing /ifeq will be used. If the question does not equal that value, that string of text will not be used.
Format the Background Color of Answers in a Table
This example re-uses the example from this article on printing out all answers in a section into a table. We recommend becoming familiar with that example first, as this section focuses only on the formatting.
Handlebars and HTML Sample:
We will "loop" through all the answers in the section, printing each question/answer pair as a table row, and formatting the table cell based on the answer
<table> |
Example Document Output
Comments
0 comments
Please sign in to leave a comment.