I am intending to design an experiment which requires the participants to choose which feedback they will get on the next trial. Normally, the trials have two different feedbacks in two different categories. Now I question them: "From which category do you want to get feedback?" with the normal html-button-response plugin. If they choose A, they should only get the feedback about category A. Same thing applies if they choose B.
I have been trying to access the "button_pressed" from the previous trial.
var skinOrStomach = 99; //flag for the choices
var questionPhase2 = {
type: 'html-button-response',
stimulus: 'Which symptom/reaction do you want to learn more about?',
choices: ['Skin reactions', 'Stomach reactions'],
on_finish: function(data){
if(data.button_pressed == 0) {
skinOrStomach = 0;
}
if(data.button_pressed == 1) {
skinOrStomach = 1;
}
}
};
...
...
for(j = 0; j < 8; j++){
timeline = timeline.concat(questionPhase2);
if(skinOrStomach == 0) { //answer is skin
timeline = timeline.concat(shuffledPhase2Skin);
}
if(dskinOrStomach == 1) { //answer is stomach
timeline = timeline.concat(shuffledPhase2Stomach);
}
}
But the lines above did not seem to work. I have also tried using jsPsych.data.get().select('button_pressed'), it also did not work.
I got the skinOrStomach variable right. However, it did not seem to be able to push the trials to timeline in the "if" conditional. So I only saw the questions for 8 times, without any trials after that. This might be a really simple coding mistake, but does anyone have any idea? Any help would be appreciated.
Thank you in advance!
Best wishes,
Gen
--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/1a026e9a-1da8-4bc2-a8d3-db81afd9520c%40googlegroups.com.
Best,
Gen