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

0 votes

I used random generator to generate 3 experimental groups, each group goes to one of the three pages after the random generater page, but after answering all the questions from one page, questions from the next page started to show automaticlly.

How to stop the questionaire when participants finish their page?

in SoSci Survey (English) by s111525 (155 points)

1 Answer

+1 vote

I strongly recommend not (!) to create different pages, but to display the appropriate contents on the same page, but only one of the three versions, e.g.:

if (value('RG01') == 1) {
  text('stimulus1');
  question('AB01');
} elseif (value('RG01') == 2) {
  text('stimulus2');
  question('AB02');
} else {
  text('stimulus3');
  question('AB03');
}

If you still want to keep you 3 pages, please give them page IDs and use setPageOrder()

if (value('RG01') == 1) {
  setPageOrder('vs1', 'dem');
} elseif (value('RG01') == 2) {
  setPageOrder('vs2', 'dem');
} else {
  setPageOrder('vs3', 'dem');
}

The page IDs in thei example would be "vs1" to "vs3" and "dem" is the page where all the respondents continue.

Last but not least, you could also use setNextPage() on each of your experimental pages. But that's too easy ;)

by SoSci Survey (71.8k points)
Thanks for your answer! I created different pages because each contains a lots of questions. basically the three pages are different versions of one part of the questionaire. It´s too many questions for a single participant, so I created 3 versions and put them on three pages.
I tried setPageOrder and it worked!! :)
actually setPageOrder didn´t work, do you perhaps know why?
neither did setNextPage, think it´s might be because I set to play one question at a time on each page...
Depends a lot on how you exactly used the functions... If you posted some PHP code and some debug information (https://www.soscisurvey.de/help/doku.php/de:create:debugging), I would probably be abe to give a qualified answer :)
I did fix this problem, by directing the rout to 'end' at the beginning of the pages that´re following.
this is the randomizing page code(no.8):
// randomly assign groups
if (value('RG02') == 1) {
    goToPage('EF1');    
} else if (value('RG02') == 2) {
    goToPage('EF2');
} else {
    goToPage('EF3');
}

then, page no.9 as usually, beginning of page.no.10:
if (value('RG02') == 1) {
    goToPage('end');
}
beginning of page no.11:
if (value('RG02') == 1) {
    goToPage('end');
}
if (value('RG02') == 2) {
    goToPage('end');
}


I still don´t know exactly what´s wrong with the setPageOrder or setNextPage codes, might be because of the order is directed to the end? e.g.('EF1','end'), ('EF2','end'), ('EF3', 'end').
or because of the loop pages on each of the three pages?
// show questions one at a time on each page
// spread items over multiple pages
$i = loopPage(count($questions1));
question($questions1[$i]);
> or because of the loop pages on each of the three pages?

Well, yes is probably the cause :) The functions setPageOrder() and loopPage() and loopToPage() must not be mixed. Each disables a previously set loop or page order.

In that case it was probably the SECOND best solution to go back to a single-page solution. I assume, the loop code is the same on all three pages? To all that differes is the array of questions that is defined per group. And this definition can easily be done in the random-group-IF.

The VERY best solution could be not to make 3 sets of questions but to use a random generator that draws a random set of questions for each respondent.

The THIRD best solution is to stay with your goToPage() solution. It's not beautiful, but will do the job ;)
yes, the code for loop pages is the same. Can you explain more about the second best option? ot if you think this would work with the VERY best solution?

I have three sets of 10 questions that need to be asked, then there´s 16 other filling/false(?) questions that should be shown along with the 10 questions and will not be analysed in the end result.
e.g. this is version 1 of the part of questionaire:

// version 1
if (!isset($questions1)) {
  $questions1 = array(  // list of question IDs for version 1 of Eyðufylling
       // Eyðufylling questions
       'E101', 'E102', 'E103', 'E104', 'E105', 'E106', 'E107', 'E108', 'E109', 'E110',
       // Upfylling questions
       'E111', 'E112', 'E113', 'E114', 'E115', 'E116', 'E117', 'E118', 'E119', 'E120', 'E121', 'E122', 'E123', 'E124', 'E125', 'E126',
  );
  // shuffle list randomly
  shuffle($questions1);
  // cache rotation in case page is repeated
  registerVariable('questions1');

Looppage:
// show questions one at a time on each page
$i = loopPage(count($questions1));
question($questions1[$i]);
}

version 2&3 are exactly the same except the 10 questions
> version 2&3 are exactly the same except the 10 questions

Then simply put the IF there.

if (!isset($questions1)) {
  if (value('RG02') == 1) {
    $questions = array('E101', 'E102', 'E103', 'E104', 'E105', 'E106', 'E107', 'E108', 'E109', 'E110', 'E111', 'E112', 'E113', 'E114', 'E115', 'E116', 'E117', 'E118', 'E119', 'E120', 'E121', 'E122', 'E123', 'E124', 'E125', 'E126');
  } elseif (value('RG02') == 2) {
    $questions = ...
  } else {
    $questions = ...
  }
  // shuffle list randomly
  shuffle($questions);
  // cache rotation in case page is repeated
  registerVariable('questions');
}

That was the second-best. The best solution would be even easier. Given your random generator with all the questions is configured to draw 26 questions per respondent. Instead of all the above stuff, you would simply write

$questions = valueList('RG02', null, 'label');
$i = loopPage(count($questions));
question($questions[$i]);

Really, that's all.
okay!
what does this code do exactly?
$questions = valueList('RG02', null, 'label');

I mean, I need to define $questions beforehand right? for three sets of questions, how do I use arrays? (sorry about all these questions, I just started to learn php coding last week ... )
Please check the valueList() command in the manual. It reads all answers from a question (batterie). And if that question is a random generator that draws multiple items, then it reads all the items. If these items, again, are question IDs (E101, E102, ...), then you'll get a list of question IDs. This is exactly what you needed, wasn't it :)

> I mean, I need to define $questions beforehand right?

No, it's left hand of the =. That means you're writing something in that (new) variable here.

> I just started to learn php coding last week ...

It's always a good time to start learning programming, congratulations :) Please don't worry, it's becoming easier over time.
...