====== answersPrint() ====== A whole range of questions that are asked in the questionnaire can be displayed with the help of the ''answersPrint()'' function. This means the participant can be shown a print view of their own questionnaire. Use the ''[[:en:create:functions:option|option()]]'' function to define a section of the questionnaire (see example). ''void **answersPrint**(string //section//)'' ===== Tips ===== The ''answersPrint()'' function calls up ''answers'' repeatedly. Therefore, information for ''[[:en:create:functions:answers|answers()]]'' also applies fully for ''answersPrint()''. If you enable the back button in the questionnaire and use filter questions, the following situation may occur: The respondents is shown a filtered question, then uses the back button, changes an earlier answers, and due to the filter, the other question is not displayed in the subsequent questionnaire, anymore. Nonetheless, ''answersPrint()'' will display the question in the print view, because it has been asked. ===== Example 1 ===== In the following example, the participant should get a print view of all questions in the questionnaire. In **Compose Questionnaire**, insert a //PHP code// element on the first page with the following content: option('part', 'all'); This command informs SoSci Survey that a section begins with the ''all'' ID right from the outset. Following this, insert a new page at the end of the questionnaire -- with a //PHP code// element and a text element. answersPrint('all'); Add the following HTML-code below -- either as text (//presentation// "HTML-Code") from the list of questions or as //HTML-element// -- in order to display a "print" button that will call up the function "file" -> "print" of the browser.
===== Example 2 ===== The questionnaire consists of two parts: after a couple of questions regarding the master data (pages 1 and 2), there is a section concerning the respondent's company (pages 3 to 5), and then a section regarding their employment situation. The respondent should get both parts separately in print view, page 6 should not appear in print view. At the top of page 3 a //PHP code// element with the following content is inserted in order to do this: option('part', 'company'); The following PHP code is inserted on page 6: option('part', false); and the following PHP code on page 7. option('part', 'job'); At the end of the questionnaire, two pages with the following content will be inserted. answersPrint('company'); answersPrint('job'); The ''buttonPrint'' text element from the above example can be optionally inserted under the PHP code for each one.