Is there a way to autofill the next multi choice questions from the previous respondse | XM Community
Skip to main content

Hi There,

Im still learning to use Qualtrics as I come from Confirmit so please forgive my inexperience.

I have a question regarding using a script for our surveys.

It is needed sometimes that we would like to autocode some multi questions. With autocode I mean that they are automatically filled in and not shown in the survey.
 

For example there are 3 questions. 1 is shown and the other 2 are automatically filled in by the previous question. 
 

first question (I want to script this because there can be many options here like 200)
Name A
Name B
Name C
Name D
Name E

2nd Question ( Also same amount of options and value but the label is different)
Mail A
Mail B
Mail C
Mail D
Mail E


3nd Question ( Also same amount of options and value but the label is different)
Adress A
Adress B
Adress C
Adress D
Adress E

Is there a way to use a script to only show the first question which is a multi so more than 1 answer van be filled in and then autocode the 2nd and 3rd question with the same value. Like first question A and C are clicked. Then 2nd and 3rd question A and C are also clicked automatically.

Thanks in advance

​​​​​​​ 

Use JS and get array of both questions' answer options and check value of each option in jquery using .is(":checked"). Then set next question same option property as .prop("checked", true).


Without JS the idea would be to set a display logic and use default choices to check the options visible. 


With javaScript, you will need to take the selected choices through pipe-text then split it using .split(‘,’)

then check it using the choiceIDs. Remember to set the choiceIDs correctly.


Thanks for the replies. Im still new to JS so pardon my inexperience.
Is there an example you guys maybe have?
Or a page where I can see how to use properties?

I found some example like this to do it for 1 multi choice online

Qualtrics.SurveyEngine.addOnReady(function() {
    var qobj = this;
    var displayedChoices = c];
    jQuery.each(qobj.getChoices(), function(index, value) {
        if(qobj.getChoiceDisplayed(value)) displayedChoices.push(value);
    });    
    if(displayedChoices.length == 1) {
        qobj.setChoiceValue(displayedChoicese0], true);
        qobj.clickNextButton();
    }
});


Leave a Reply