How to group multiple choices in Multiple Choice question?

cqulihuicqulihui Community Member Qubie ✭
edited June 2 in Custom Code

How to group multiple choices in Multiple Choice question?

Hi, Qualtrics community

We have a list of options for subjects to select from. I use Multiple Choice question-->Multiple Answers. But I want to group the options and make subjects select more than one options.
I tried to add groups and assign options to different groups. But I found that the layout can only be verticle. I think the list of options is too long and want to use matrix layout. How can I do that?
Here is a picture which depicts how I want to design the layout of the questions. Could anyone help me?
Thanks very much!
(The attached file shows the design)


Best Answer

  • [Deleted User][Deleted User] Qubie ✭
    Accepted Answer

    Hello @cqulihui ,

    Paste the below code in the js(OnReady) of the matrix profile question

    var that =this;
                    var r = ["1,2","2,1"];
                    for(var i=0;i<r.length;i++){
                                    var t1 = parseInt((r[i]).split(",")[0]);
                                    var t2 = parseInt((r[i]).split(",")[1]);
                                     jQuery("#"+this.questionId+" .ChoiceRow:eq("+(t1 - 1)+") .c"+(t2 + 3)+"").hide(); 

    You need to only change the var r line. The var r is set in the below format.

    var r = ["r1,c1","r1,c2",....,"rn,cn"];

    Hence you need to make row and column pair to hide particular choice. So to hide third and fourth choices in the second row the r will be as below

    var r = ["2,3","2,4"];


  • flebfleb Czech RepublicCommunity Member Sage ✭✭✭

    Hi @cqulihui,
    what about having three questions, remove separators between them and write a JavaScript to ensure that two or more options in total are selected? Should it be possible to skip all three questions or not? If not, one way could be to disable the next button until the condition is met.

  • cqulihuicqulihui Community Member Qubie ✭

    Hi @fleb,
    Thanks very much for your speedy reply.
    I use Matrix Table --> Profile, Multiple Answer question, and I want to hide some choices in some positions. For example, if the first row has 4 choices and the second row has only two choices, I can hide the third and fourth choices in the second row.
    I had a try but I found that I can only hide the choices in the first row. How can I hide the choices in the second row or even, say, the sixteenth row?
    Here is my code:

    jQuery("#" + this.questionId + " .ChoiceRow:first").find("th.c8").hide();
    jQuery("#" + this.questionId + " .ChoiceRow:second").find("th.c8").hide();
    jQuery("#" + this.questionId + " .ChoiceRow:sixteenth").find("th.c8").hide();

    How can I find a certain row?
    Thanks again.

  • cqulihuicqulihui Community Member Qubie ✭

    Hello @Shashi,
    Thank you very much! It works for me! Thank you!

Sign In to Comment