Translations of this page:


void buttonHide()

The function buttonHide() stops the Next and/or Back button being automatically inserted at the end of the questionnaire page. This is useful, for example, if certain participants are not allowed to participate (Filters: Screen Out) or if the questionnaire should be suspended until the next survey date (see below).

Warning: If you disable the Next button, the participant can no longer go onto the next page – not even if JavaScript carries out the forwarding (see below).

Note: If the function buttonCode() is used in order to reposition the button, then the button is automatically hidden at the end of the questionnaire. Therefore, the function buttonHide() is not necessary.

Example: Pause Between Survey Waves

The following example assumes that a two-wave (or multi-wave) survey shall be carried out. It is important when it comes to filtering, that responses in the first questionnaire can be accessed in the second questionnaire. Therefore both parts are compiled into one questionnaire – however, a page that pauses the questionnaire is inserted between the two parts using buttonHide(). This only shows the participant that they have completed the first part of the questionnaire, which is stored as a text element “goodbye1”.

In order to answer the second part of the questionnaire (i.e. the second questionnaire from the participant's perspective), they have to resume the questionnaire at a later date. The example assumes that they receive a second mailing in order to so, which was created a reminder Send Mailings. This can be done by the project manager sending it at a certain time or it can be sent automatically by using mailResume().

The PHP code on the page that interrupts the survey must ensure that questionnaire cannot be resumed immediately and can only be accessed no sooner than (e.g.) one week (7 days = 168 hours = 604800 seconds) after the page first accessed. The time the page was first accessed can be retrieved using time() (as a Unix timestamp = seconds since 1970) and saved in the variable $t0.

// Save the time of the first visit to the page.
if (!isset($t0)) {
  $t0 = time();
// Check if a week has already passed
if (time() < $t0 + 604800) {
  // show the first questionnaire has been completed
  // Do not display any buttons, otherwise the questionnaire would not have actually been completed  
} else {
  // It might be worth setting the progress bar to 0%
  option('progress', 0);
  // The page is called up after the freeze period has expired,
  // and it continues with the next page

Note: Please take into consideration that a participant could leave the first part of the questionnaire. The invitation to take part in the second-wave would then not lead him to the page where the questionnaire pauses, but to the page were he left the questionnaire.

Tip: Choose the length of time that the pause will be displayed. This should not be too long if you send the invitations manually at defined times. Otherwise, a participant who responds extremely late to the first invitation may be shown the pause after receiving the second invitation.

Tip: If you allow the Back button in the questionnaire, you may want to let this stay active on the page where the questionnaire is paused. You achieve this by using option('backbutton', false) instead of buttonHide().

Hide the Next Button for JavaScript

If want to forward the user to the next page with JavaScript (Timer: Go Automatically onto the Next Page), then save the following JavaScript code as a text element and insert it into the questionnaire page:

<script type="text/javascript">
// -->
en/create/functions/buttonhide.txt · Last modified: 15.01.2015 20:28 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