====== pageStop() ======
''void **pageStop**()''
This function prevents further contents of a questionnaire page being shown or executed.
If there are other commands within a PHP code element in the questionnaire, ''pageStop()'' also prevents their execution.
===== Example: Screenout =====
In the following example, ''pageStop()'' is combined with a screen out filter. This means further content (e.g. questions) can still be put on the screen out page.
The filter shows the text element "screenout" and hides the Next and Back buttons for people who answered question SK01 with value 1 (younger than 18) or 7 (older than 65). This means the questionnaire is effectively terminated.
Other elements (questions, PHP code, ...) can be put on the page beneath this PHP code. They can also be put on the questionnaire page by drag & drop. ''pageStop()'' ensures these elements are no longer shown to participants who do not qualify.
if ((value('SK01') == 1) or (value('SK01') == 7)) {
text('screenout');
buttonHide();
pageStop();
}
If ''pageStop()'' is not used, the other elements have to be included in the filter...
if ((value('SK01') == 1) or (value('SK01') == 7)) {
text('screenout');
buttonHide();
} else {
question('AB01');
question('AB02');
}
...or the content has to be inserted onto an additional page (after the current one) so that there is no more content on the page.
if ((value('SK01') == 1) or (value('SK01') == 7)) {
text('screenout');
buttonHide();
} else {
goToPage('next');
}
**Important:** The text "screenout" may only be integrated into the questionnaire page via the PHP code. Do __not__ drag the text into the page as well.
===== Example:Time Restriction =====
Sometimes the survey project uses several questionnaires -- and not all of them should be available for the same time period. At the same time, only one survey period can be defined for the entire survey project in the **Project Settings**.
With a small PHP filter on the first page of the questionnaire, you can specify that only an error message is displayed outside a defined time period.
Create a new text in the **List of Questions** in a section of your choice. The following example assumes that the text has the identifier TX02. The following PHP code ensures that the questionnaire can only be completed in the period between 01/04/2021 and 30/06/2021.
if ((time() < strtotime('2021-04-01')) || (time() >= strtotime('2021-07-01'))) {
text('TX02');
buttonHide();
pageStop();
}
The survey period specified in the project settings must start before 4/1/2021 and/or end after 6/30/2021 for the filter to be active.
In the same way, you can restrict that the questionnaire can only be filled out in a certain time window. The following PHP code allows filling in only from 9 to 11 o'clock.
if ((date('h') < 9) || (date('h') > 11)) {
text('TX02');
buttonHide();
pageStop();
}