This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:
 

This is an old revision of the document!


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 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 answers() also applies fully for answersPrint().

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');
text('printButton');

The “printButton” text element has the following content.

<div>
  <button type="button" onclick="window.print();">Print</button>
</div>

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.

en/create/functions/answersprint.1429434969.txt.gz · Last modified: 19.04.2015 11:16 by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki