This is an old revision of the document!
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 option()
function to define a section of the questionnaire (see example).
void answersPrint(string section)
The answersPrint()
function calls up answers
repeatedly. Therefore, information for answers()
also applies fully for answersPrint()
.
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'); text('printButton');
The “printButton” text element has the following content.
<div> <button type="button" onclick="window.print();">Print</button> </div>
The questionnaire consists if 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.