How do I make a choice group in a multiple choice question exclusive? | XM Community

How do I make a choice group in a multiple choice question exclusive?

  • 11 October 2022
  • 5 replies
  • 2190 views

Hello,
I have a multiple choice question that allows multiple answers. The answer choices are split into two groups and I want participants to be able to choose answers within only one group, but as many answers they want within that group. For example:
Group A

  • Choice 1

  • Choice 2

  • Choice 3

Group B
  • Choice 1

  • Choice 2

  • Choice 3

  • Choice 4

  • Choice 5

Participants should be able to select as many choices as they want with Group A or B, but if they select any choices in Group A they won't be able to select any in Group B and vice versa.

I tried custom validation, but that didn't work they way I needed. Is there javascript to achieve this?


5 replies

Userlevel 4
Badge +23

Probably not the exact answer you are looking for, but display logic is intended to display or present a question based on a prior condition. In page display logic is not available at the answer level, but more question level.
Likely not the aesthetics you want, but I would recommend creating a selection question that outlines the options and display the two groups. Then create the selection question on the next page display logic on the answers based on the prior selection.
Be sure not to include a back button so they have to progress and avoid answers from both groups. I think even with Java, you'd have to include script to deselect answers from the other group, not just hide them. Answers can remain selected even if hidden. You have to set up the question in a way they can only select from one group of answers.
Example:
image.pngimage.pngimage.png

Userlevel 7
Badge +35

Roma Shah
Instead of doing this you can create two multi choice questions and hide the question text of second question and remove the space with below codes. It would look like this:
image.png
Your question here /* Hide question */
jQuery('.QuestionText').eq(1).css('display','none'); /* remove space */
Once this is done you can uncheck all items from Q1 if Q2 is answered via JavaScript.
Qualtrics: Reset Likert Matrix. Works with single or multi-select matrix. Add button html to question text. #qualtrics #js #jq #matrix #likert #reset · GitHub
Hope it helps!


Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/22610/how-do-i-make-a-choice-group-in-a-multiple-choice-question-exclusiveYes, it can be done with JS:
Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery(this.questionContainer);
q.find(".checkbox").click(function() {
if(this.checked) q.find(".ChoiceGroupStructure").not(jQuery(this).closest("ul")).find(".checkbox").prop("checked",false);
});
});

Badge +2

@TomG how would I add this if I have a Yes No for choices (single select), and if yes s selected, a list of options appears (multiple select)

Userlevel 7
Badge +27

@TomG how would I add this if I have a Yes No for choices (single select), and if yes s selected, a list of options appears (multiple select)

It would be easier to do a yes/no question followed by a MC question on the same page with in-page display logic.

Leave a Reply