0 votes
ago in SoSci Survey (English) by s106223 (195 points)

I am trying to make a Stroop task in Soscisurvey using Assignment.

The main block of the task (without feedback) is ok.
However, I need to present error feedback in the practice block.

I tried validating the response on each item from Assignment task individually - not working (not possible?), I gave up on that as I will discard the practice trials anyway.

I tried a simpler solution, following examples from here: https://www.soscisurvey.de/help/doku.php/en:create:feedback-correct.

I created several one-item assignments, and put each one on separate pages.
After each one, I added the page with the following php code:

if (value('ST01_01') != 1) {
    goToPage('ST1'); # repeat page essentially
} else {
    goToPage('ST2'); # go to next page
}

It does not work, and I just cannot figure out why.
When I answer correctly, it presents the next question page. (everything's fine)
But if I answer incorrectly, it returns a blank page with back and next buttons.

Tried debugging it, the value recorded corresponds to the one I chose.

If anybody has a specific idea on what could be wrong here, or if you have any advice/example code on designing a Stroop task in soscisurvey, I would be eternally greatful.

Thanks!

2 Answers

+1 vote
ago by SoSci Survey (370k points)
selected ago by s106223
 
Best answer

PHP code works between the SoSci Survey questionnaire pages.

If you want to give immediate feedback, you'll need to work with JavaScript instead.

I created several one-item assignments, and put each one on separate pages.

Well, that will cause unpredictable loading latencies, so I strongly discourage this option. If you still want to follow the trail, please use repeatPage() and put the code into the "PHP for processing responses" (at the bottom of each questionnaire page).

Otherwise take a look at the JavaScript Connection for the assignment task, please. This allows to respond to each choice even when all items are part of the same question.

ago by s106223 (195 points)
Thank you for clarifying things for me. I managed to get it working with JavaScript - I added the error feedback successfully and pasted the solution as an answer to my own question (for formatting). I will also try to add the "timeout" feedback - if successful, I'll add it as well.
0 votes
ago by s106223 (195 points)

A working solution to the question above.

<script type="text/javascript">
<!--
function selFilter(item, option) {
// Remove old feedback
var old = document.getElementById("ST01_feedback");
if (old) old.parentNode.removeChild(old);

var correct = { 1: 1, 2: 2 };

if (option !== correct[item]) {
    var container = document.getElementById("ST01_qst");
    var feedback = document.createElement("div");
    feedback.id = "ST01_feedback";
    feedback.innerHTML = "X";
    feedback.style.color = "red";
    feedback.style.fontSize = "50px";
    feedback.style.fontWeight = "bold";
    feedback.style.textAlign = "center";
    feedback.style.position = "fixed";
    feedback.style.top = "40%";
    feedback.style.left = "0";
    feedback.style.width = "100%";
    container.insertBefore(feedback, container.firstChild);
    return -2;
 }
}

SoSciTools.attachEvent(window, "load", function() {
    assignmentST01.setCallbackSelect(selFilter);
});
// -->
</script>

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

...