I was wondering if someone can help me out on the following issue: Participants are presented different behaviours that they have to rate on a slider from -3,-2,-1,0,1,2,3. All behaviours are presented on separated pages. Now, I want each previous response to be the default function of the behaviour that is presented next.
For example: Participant is shown first behaviour, default setting is "0". He/She rates the behaviour with "-2". Participant is shown second behaviour, default setting is now "-2".
Etc.
I understand that I have to set an embedded data variable. I was told to save the participants slider response and keep overwriting this. However, I'm very new to Javascript and I'm not sure how to save the participants' slider response.... Any help would be hugely appreciated!
I think for overwriting the embedded data variable 'Output', I use: [Qualtrics.SurveyEngine.setEmbeddedData('Output', 'response_variable'); However, I am not sure how response_variable can capture the sliderresponse.
This 'response_variable'
is just a placeholder from some instruction you received, you need to declare variable to store value of your slider and pass this variable as second parameter.
To save value (Docs: getChoiceValue, addOnPageSubmit, setEmbeddedData):
Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
if(type == "next")
{
var value = this.getChoiceValue(1); // assuming sliderId == 1
Qualtrics.SurveyEngine.setEmbeddedData("Output", value);
}
});
To set value in next question (Docs: setChoiceValue ):
var lastValue = "${e://Field/Output}";
this.setChoiceValue ( 1, lastValue );
PS. You may also need to store information about direction (next/previous) and add condition to avoid setting value after click on "previous" button
PS2. In case this did't work see also this thread