0 votes
in SoSci Survey (English) by s208019 (160 points)
edited by SoSci Survey

Hello,
We use a multi-day survey in the format of one long mobile questionnaire. Each day in the morning, participants receive a text message to invite them to continue the questionnaire. That means, on the end of each day, we hide the continue button and schedule the next notification.
When receiving the SMS and clicking on the embedded link, the questionnaire opens up on the last page accessed, then offering to click continue. However, I would ideally want to send the participants directly to the next page. Can someone suggest me how I should modify the code?

Thanks!

//SMS Schedule option('backbutton', false);

// Schedule the initial SMS/email to be sent at 08:00:00 mailResume(false, 2, strtotime('+1 day 08:00:00') - time());

// Schedule a reminder SMS/email to be sent the next day at 08:00:00 mailResume(false, 12, strtotime('+2 day 08:00:00') - time());

// Determine the current time $currentTime = time();

// Set the time to start showing the Next button (30 minutes before the first SMS, i.e., 07:30:00) $showButtonTime = strtotime('+1 day 07:30:00');

// Unhide the Next button if it's 07:30 or later if ($currentTime >= $showButtonTime) {
    option('nextbutton', true);   //  goToPage('next'); // Replace 'next' with the actual page identifier if necessary } else {
    goToPage('next'); // Replace 'next' with the actual page identifier if necessary
    option('nextbutton', false); // Keep the Next button hidden if it's before 07:30 }

1 Answer

0 votes
by SoSci Survey (327k points)

We use a multi-day survey in the format of one long mobile questionnaire.

Please note that this may cause issues, if respondents do not follow the invitation every day. If they miss a day, they may get the page from the previous day next time.

I would ideally want to send the participants directly to the next page.

Please follow the manual on break pages, which is hidden under buttonHide().

by s208019 (160 points)
Hiya, it's not an issue if they miss one day and then continue where they left off!
Regarding the buttonHide(), the help page suggested does not solve my problem.
The issue i'm currently facing is I need to unhide the button at a specific time for them to continue, which should be more or less exactly around the time when they receive the text message with the link. In the code above i set the SMS to 8am and unhiding the button to 7:30. I would want to use the same schedule over the 10 days of the survey. The issue is that when participants work on the survey, it's always past 7:30am and hence the next button appears available. I've tried using +1day 7:30:00 instead, but then the opposite issue occurs, namely that the button is never available.
Is there a way to tie the appearance of the next button to the link sent via the mailing?
by SoSci Survey (327k points)
The manual should solve the issue that the respondents have to click the "next" button instead of automatically getting to the next page.

If I get you right, the problem is: You want to show the button on one page, and hide it on the other one - and both around the same time.

I would recommend that you store a PHP or dataset variable for each day. I'll use an internal variable here (not a PHP variable), because it seems useful to me in your contect to see the times in the dataset. What you would to, is to set the current timestamp to an internal variable on the first page of a day, such as:

if (!value('IV01_01', 'code:ifany')) {
  put('IV01_01', time());
}

On the page with the next button for page 1, you can check if 23 hours have passed.

$started = value('IV01_01');
if ($started < time() + 82800) {
  goToPage('next');
} else {
  text('XY00');  // Say goodbye for the moment
  buttonHide();
  pageStop();
}

Create internal variables for each day, and replace the IV01_01 in the code for each day (IV01_02, IV01_03, ...).
by s208019 (160 points)
Thanks for the response! No, this is not exactly my problem. I am trying to unhide the next button based on a specific time, rather than a time interval. Since we invite participants to work on the questionnaire in the morning, this time would need to be set to smth like 7am. However, once getting to the next day page, it's naturally still past 7am and the button for the next day is available, which it shouldn't. I thought that adding the +1day would sort out the issue, but as I said earlier, then the button is aways hidden
by SoSci Survey (327k points)
> based on a specific time, rather than a time interval

Your description says that you need a time interval. If you want to show the button after 7am, but not after 7am on the next day, then there must be a time when is is hidden.

>  I thought that adding the +1day

I think that the issue is your reference time. What is the reference you're adding the 1 day to? In my example above, the reference would be the time when the respondents start filling out the daily questionnaire. But it could also be 7am on that day:

put('IV01_01', strtotime('7:00'));

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...