Using JS behaviour to interact with questions | XM Community
Skip to main content

I had a previous post where I was asking how to use the JS feature to interact with a question: 

It was very helpful but I didn’t get a complete answer. For example, I want to have a question record the answer of the participants, how do I interact with Qualtrics in the code and have do the function I need it to do. 

// For the initial question (where I want to capture the response):

Qualtrics.SurveyEngine.addOnload(function() {
var that = this;
this.questionclick = function(event, element) {
var response = that.getChoiceAnswerValue();
Qualtrics.SurveyEngine.setEmbeddedData('previous_question_response', response);
};
});


// For the subsequent question (where I want to display content based on the previous response):

Qualtrics.SurveyEngine.addOnload(function() {
var previousResponse = Qualtrics.SurveyEngine.getEmbeddedData('previous_question_response');

if (previousResponse == "Some Value") {
// Show related content for "Some Value"
jQuery('#SomeQuestionID').show();
} else if (previousResponse == "Another Value") {
// Show related content for "Another Value"
jQuery('#AnotherQuestionID').show();
}
// Continue for as many conditions as you need
});

This isn’t functional code but lets say for example I wanted to do this, what commands would I be using to interact with Qualtrics. Also is Qualtrics even able to do what I want it to do 

 

So I’ve hit a bit of an issue with the carry forward options. I have a large list of items in multiple groups is that are presented randomly (5 random groups and 5 random items from the groups). Each participant rate each item and then will answer questions based on these ratings. They will then go on to rank all the items above a certain rating. These items will then be placed in a bracket style question and this not that questions. So basically there is a lot of logic that’s based on the original ratings and for the later questions to work I need to use something that can record the dynamic list presented to each participant. The qualities support said I could try to work it out with display logic and some carry forward logic. However with approximately 1400 items this seems rather unlikely.

so I was wondering, is it possible to use the JS features and abilities to construct a code that will record the answers and pass them on later in the survey. So if someone rates A, C, G as a 5 all of those options will carry forward. And then in the later questions will do A vs C and then record the winner and pass it on. Any help would be appreciated!
 

!...]

So if they rated 15 item as 3, 4, 4, 3, 5 … all the ones above 3 they would be listed in the next question. Then they would rank them as which they prefer most so if item A - E were present they would rank them as E B D C A (this question is independent from the follow up ones) . Then for the next section it’s would choose two items, from the 15 that were above 3, and put them against each other. A v. B, C v. E (and D can be incorporated with the next round). Which ever  item is chosen will face each other (so if A, and E we’re chosen) the next round would be A v. E and B v. C and D v. one of the items selected randomly. Then a final ranking would be given based on the answers ( ex. 1.E 2.A 3.C 4.D 5.B. So each “battle” is a bracket and the winner moves on. The winner of each bracket is used for the next question. 

Alternatively if there is an easy way of having the same type of questions for a large list that would be appreciated. 

Be the first to reply!

Leave a Reply