Postfilling survey questions
Postfilling is similar to prefilling; however, answers are filled in after the page is submitted and the answers for the page are saved. Use CSL to refer to questions on the same page for postfilling.
For example, say you have five questions with scores and a Total hidden slider question. The slider question, even though it is on the same page with five questions, can be postfilled with the sum of the scores. You do not need to place it on the next page.
Questions with postfilling should be hidden and not required.
The postfilling settings are located on the Prefill tab when prefilling is set to Fixed text or CSL.
Postfilling can also be used to modify a respondent's answer since postfilling is always done, even if a question already has an answer, which is also different from prefilling.
In the question editor, you can specify a response for a question ahead of time. This can be a fixed value, a variable, or a random selection.
Setting postfill values for questions
Mark the question as not required. Then test the postfilling of the question and mark it as Hidden.
Postfilling a question to use in display logic and branching
Sometimes you may want to use a calculation or other CSL in page display logic or branching. Since this cannot be done directly, you can use your calculation to postfill a question. Then you can use the question in your display logic or branching. In this case, the question will also be available in the reporting for filters, for example, if you want to show a page if a respondent selected more than one answer in a checkboxes question, maybe to show them a rank-order question.
To do this, complete the following steps:
Create a hidden radio button question More than 1 option chosen? with two answer choices (yes and no) at the bottom of the page with the checkboxes question.
Make sure your checkboxes question has a data label since you will need it to refer to the CSL.
- In the radio buttons question, click the Prefill tab, select Fixed text or CSL from the dropdown, and enter the following CSL:
{{#if (gt (count respondent.questions.myLabel.answerChoices) 1)}}yes{{else}}no{{/if}}
What this says is if the count of answer choices selected in the question with data label 'myLabel', is greater than (gt) one, select 'yes' otherwise select 'no'.
You can also replace the 'yes' and 'no' in the code with '1' and '2', which stands for the first and second answer choice. You will need to that if your survey is multilingual.
Select Yes for Postfill value after page is submitted?
Now you can use the radio buttons question in your display logic, branching, and reporting.
Order of execution
The order of processing is important. The following is the order in which postfilling occurs:
- Answers are saved in the order they are placed on the page.
- After the answers to the questions have been saved, the system cycles through them again, in the order they appear, and postfilling is processed.
- Display logic and branching are checked to see which page to render next.
Since all the answers are first saved then postfilling is done, this means that question one can be post filled with a value that depends upon an answer to question four, if they are on the same page.