0 votes
in SoSci Survey (English) by s219203 (310 points)
closed by s219203

To recap, I would like to use subquestions in the selection sequence (I call them "bogus") as filter variables, such that when a certain answer is given, the filter reacts immediately and stops the interview.

Here's what was suggested:

What you need is such a JavaScript code on the page, and it may have to say something like this:

function onSelect(evt) {
var info = evt.detail;
if ((info.item == 91) && (info.value != 2)) {

SoSciTools.submitPage();

}
}

This is for item 91 for now, you'll have to add conditions for the other 3 bogus items as well.

For the error message, you may need a little PHP filter on the next page.

Here's what I have so far...

...as a 4 text elements (HTML code) on the same page as the selection sequence:

<script type="text/javascript">
<!--
function onSelect(evt) {
  var info = evt.detail;
  if ((evt.detail.item == 91) && (evt.detail.value == 1)) {
    SoSciTools.submitPage();
  }
}

var question = document.getElementById("IT03_qst");
question.addEventListener("select", onSelect);
</script>

...as a PHP code on the next page:

    if ((value('IT03_91') == 1) or (value('IT03_92') == 1) or (value('IT03_93') == 2) or (value('IT03_94') == 2)) {
  text('GT03');
    buttonHide();
    pageStop();
} else {
  question('RA01');
}

My understanding is that the value entered in both codes are the filtering values? I.e., if the participant answer 1 to element 91, the interview should stop.

The JavaScript text element DOES work, as a "wrong" answer will stop the selection sequence task. However, the "goodbye text" (GT03) DOES NOT appear, but rather the next task (question RA01).

I've tried to split the code in 4 different PHP codes but it still doesn't work.

Any other idea?

closed with the note: No longer needed
by SoSci Survey (320k points)
First, rearrange your array_merge() code so that the bogus items appear at the beginning. This will make testing much easier.

Then please answer "1" to item 91, and tell me what the debug information on the next page says?
by s219203 (310 points)
My team and I reassessed this feature and decided not to filter out participants during the interview. I'll close this discussion.

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

...