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?