SoSci Survey
Translations of this page:
 

goToPage()

void goToPage(string pageID)

This function jumps directly to another page in the questionnaire (without executing other commands on the current page) and shows the questions there. If questions or text have already been output on the current page, the content of the other page is directly attached. Therefore, in some cases, the contents of multiple questionnaire pages are output on one page with goToPage().

  • pageID
    • The ID of the page the questionnaire continues onto. An ID has to be assigned for this page (the jump destination) when composing the questionnaire.
    • Instead of an existing ID, 'end' (end questionnaire) and 'next' (next page) can also be used.

Entering a Page ID

  • The command goToPage('end') ends the survey immediately and shows the last page (End Questionnaire).
  • The command goToPage('next') always jumps to the next page in the questionnaire.

Note: 'end' and 'next' can also be entered as IDs for existing pages. In this instance, the special functions of these IDs are deactivated and goToPage() jumps to the respective pages.

Example

See also Filters and Conditional Questions

The following example assumes that a multiple-choice selection AB02 with 8 items was offered on page 1 of the questionnaire. If the participant selected option no. 7 (AB02_07), page 2 of the questionnaire should be skipped by using goToPage(). Page 3 in the questionnaire – the jump destination – has the page ID “pa”.

if (value('AB02_07') == 2) {
  goToPage('pa');
}
question('XY01', '1,3,4,5');

It is worth noting that all content from page 2, which is behind the filter, – e.g. question XY01 – is only shown if option no.7 was not selected. If goToPage() is used the following content is not shown anymore. All respondents can then see the contents on page 3 again.

Tip: If you want to display a page again because the data given by the participant was incomplete, use the function repeatPage() instead of 'goToPage(), . This means the Back button remains fully functional.

Tip: Please also be aware of the function setNextPage(). This function does not jump directly to the specified page, but only after the participant has clicked on “Next”.

End Questionnaire

The command goToPage('end') ends the survey immediately. If the current page has already output questions, these will not be shown anymore. Therefore, do not use this command on a page where its content should still be shown. Where necessary, put the goToPage('end') at the beginning of the next page.

// If "I would like to participate in the study" was not checked
// (AB01_01) was set, the questionnaire jumps directly to the end and displays a message stating that the questionnaire is complete
if (value('AB01_01') == 1) {
  goToPage('end');
}

Note: Do not use the ID “end” for an existing page in the questionnaire. Otherwise, the command goToPage('end') leads the participant to this page and the questionnaire does not end anymore.

Tip: If you want to end the questionnaire but would like to display a different text, do not use goToPage('end'), but rather buttonHide() in conjunction with a text element. The participant then cannot leave this page anymore – the questionnaire is effectively terminated, however it will not be marked as completed (FINISHED) in the data record.

if (value('AB01') < 2) {
  text('no interest');
  buttonHide();
}
en/create/functions/gotopage.txt · Last modified: 27.06.2017 08:45 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki