[[option()]]
Translations of this page:
 

option()

void option(string option, mixed setting)

The appearance of a page in the questionnaire can be altered with option(). The command option() can be put on every page in the questionnaire where the appearance should be altered simply by using PHP code. The following options and possible – differing depending on the option – settings are available:

  • 'progress' – Modify progress bar
    • 'no' – Hide progress bar
    • 'yes' – Display progress bar (if it was disabled for the questionnaire)
    • 0 to 100 – Display this percentage of progress
  • 'progress.last' – Define on which side the progress bar reaches 100% (default: “end”)
  • 'nextbutton' – “Next” button
    • Text (string) – Display this text on the Next button
    • false - Hide the Next button on the current page
  • 'backbutton' – Back button
  • 'breakbutton' – Button to pause the questionnaire
  • 'leavebutton' – Button to leave and delete the questionnaire
    • false – Hide the corresponding button (if it was enabled in the questionnaire settings)
    • true – Display the corresponding button (if it was not enabled in the questionnaire settings)
    • Text (String) – Display button with the text given
  • 'langbutton' – Buttons to select language during the questionnaire
    • false – Hide buttons (if they were enabled in the questionnaire settings)
    • true – Display buttons (if they were not activated in the questionnaire settings)
  • 'layout' – Use another layout for the current questionnaire page
    • ID (String) – ID of the layout to be used for the page
  • 'resume' – Hide information that the questionnaire is resumed after a pause
    • true – Hide information, because the questionnaire is expected to be resumed here
    • false – Display information (default setting)
  • 'warn.leave – Show/hide warning when respondent closes browser window
    This setting corresponds to the selection option Compose QuestionaireSettings → “Show a warning if browser back button is used or window is closed”
    • true – Show hint (if supported by browser)
    • false – Deactivate hint
  • 'probing' – Remove the current page from the back history
    If you use an additional page to check for missing answers and allow a back button at the same time, you can use this setting to specify that the respondent skips the additional page on “back”.
  • 'part' – Set the start of a new questionnaire section for the print preview, s. answersPrint()
    • Text (string) – Any designation of the section
  • 'questionNumber' – Continue the automatic numbering of questions with the specified number.
    • number (integer) – Number ≥ 1

Note: The command option() is only suitable for changing the labels of buttons on individual pages. If you want to change the labeling in general, define then in Text Elements and Labels (Instructions for Common Jobs).

Note: In general, if you do not want to display a progress bar, disable it in Compose QuestionnaireSettingsDisplay progress bar.

Note: The option 'resume' is helpful if you want to pause the survey on purpose at a certain place – e.g. to conduct multiple survey waves in the same questionnaire (buttonHide()). The option must be placed before the participant leaves the questionnaire, e.g. right at the beginning of the page. Pausing the questionnaire at a specific place can be achieved by hiding the Next button with option("nextbutton", false).

Progress Bar

The following PHP code ensures that the progress bar is hidden on an individual page (e.g. on the welcome page):

option('progress', 'no');

Adjusting the progress displayed is also possible. When the following PHP code is put on a page in the questionnaire, 30% progress is displayed.

As of version 2.5.00, the progress on following pages will be calculated on the basis of the set value. In older versions of the program, the progress has to be set individually for each page. In general, the progress has to be set individually for previous pages, e.g. if the progress bar should run more “slowly” at the beginning.

option('progress', 30);

Buttons in the Questionnaire

The Back button will be hidden on an individual page with the following PHP code (as long as this button is enabled in the questionnaire):

option('backbutton', false);

If back buttons in the questionnaire are generally disabled, they can be shown again for individual pages:

option('backbutton', true);

When the following PHP code is put on the penultimate page in the questionnaire, the “Next” button is given the label “Submit details” and the “Back” button is given the label “Change details”.

option('nextbutton', 'Submit details');
option('backbutton', 'Change details');

Layout

Should extensive stimulus be displayed in the questionnaire, reflecting a website? The “normal” structure of the questionnaire is probably too narrow to do this and interferes with the appearance.

Open Questionnaire Layout in the menu. If you have not yet activated a layout, activate the “SoSci Survey Standard” layout first of all in Layout Templates (so the questionnaire appears in the default layout). Afterwards, activate the “SoSci Stimulus Presenter” layout – this is given the ID “presenter”.

Use the following PHP code on the page with the stimulus on it, which allows the structure of the questionnaire to disappear:

option('layout', 'presenter');
en/create/functions/option.txt · Last modified: 05.09.2020 13:06 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki