How do i randomize a subset of text in a question? | XM Community
Skip to main content

Community,

I am trying to create a list experiment that looks like the following:

 

“Report how many of the items are true for you:

  1. A
  2. B
  3. C
  4. D

How many items are true for you?”

 

The answer provided would be in a text box. I want to randomize the order of the items in the list without manually creating different questions. Is there a way to do this?

Hi @TaylorO You can use choice randomization for your use case.


@omkarkewat 

From what I am seeing, choice randomization is only available when the list items are choices. Because I want my response to be a text box, the choice randomization is not popping up for selection at all.


@TaylorO I’m trying to understand your use case.


Q1. Report how many of the items are true for you (Multiple select):

  • A
  • B
  • C
  • D

Q2. How many items are true for you?

       Open entry text box (it will consist of the selected choices from Q1 and it should be in a random order)

 

Is my understanding correct? If yes, then can you explain how did you bring the selected choices in an entry text box and will the respondent select the choices from an entry text box?

 


It would be all in one question. The list items are not multiple choice, just text.

 

Q1. Report how many of the items are true for you. Don’t report which items, just HOW MANY:”

  • A
  • B
  • C
  • D

How many items are true for you? (1-4)

       Open entry text box (where respondents can enter the digits 1-4)


@TaylorO Ohhh okay got it!
This will require a bit of manual work as well as this solution is without Javascript.

STEP 1:

Create 4 embedded data. You can name it according to your wish and the value will the one that you want to display in the question text list.

STEP 2: Create as many as different combinations possible by just changing the order of the values. Please refer below images.

STEP 3: Insert all these 4 groups inside a randomizer and keep its value as 1 and tick off the ‘evenly present elements’ box for fair randomization. This will ensure that it chooses one combination (group) at a time to a respondent. There will be 4 random combinations, you can create as many as you like.

STEP 4: Pipe text all the 4 embedded data in your question text in a list format (as you require).


Your use case could be possible by JS as well but if you want to do it without JS you can try this method.


@omkarkewat  Thank you! Do you know how to do it with JS? 

I want to do all possible combinations, which is a lot since I have multiple questions like this and some with more than 4 items.


@TaylorO I think there is an easier solution for you. If you make the one question it’s own block the randomization can be much less laborious. It could even be within a larger block if a back button is important to you using advanced randomization.

 

  • Create this one question with 6 questions - 5 text/graphic and then 1 text box question type
  • Use the block editor to randomize questions 2-4

 

You can use Look & Feel to decrease the space between questions (see this post).

 

 

 


@omkarkewat This was actually the first thing I tried! But even with the compact spacing, the items are too far apart. I may just have to go the manual route.


@TaylorO:

Add a multiple choice question where the list items are the choices before your text entry question (on the same page). Randomize the choices and add this JS:

Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery(this.questionContainer);
q.find(".QuestionBody").hide();
q.find(".QuestionText").css("padding-bottom","0px");
var list = q.find("ul.list").css("margin-bottom","0px");
q.find("label.SingleAnswer>span").each(function() { list.append("<li>"+this.innerHTML+"</li>"); });
});

Add this HTML to the bottom of the question text:

<ul class="list"></ul>

 


@TomG I added the JS and the HTML, but the list is now not displaying at all.


@TomG I added the JS and the HTML, but the list is now not displaying at all.

Can you post a public block preview link of your question?


@TomG 

https://albany.az1.qualtrics.com/jfe/preview/previewId/f6985df2-a584-49ac-aa4b-ad95d516b58f/SV_1ImRaUKEZ9YI0Au/BL_5w48Ur6GOVsnDue?Q_SurveyVersionID=current

 

It is only displaying the second question.


You added the <ul> html to the wrong question. It should be added the multiple choice question text, not the text entry question text.


@TomG That worked, thank you!!


Leave a Reply