Repeating block in survey flow and want to remove/hide previous answer choice | XM Community
Solved

Repeating block in survey flow and want to remove/hide previous answer choice

  • 16 May 2020
  • 6 replies
  • 233 views

Userlevel 1
Badge +6
  • Level 2 ●●
  • 16 replies

Hi,
In my survey flow, participants play a brief game. After the game, a single answer multiple choice question is presented asking whether they want to "continue playing" or "stop playing". This sequence repeats for up to 20 rounds.
In my survey flow, the same block and question is used to ask participants if they want to continue or stop playing after each round. As a result, the answer choice that was selected on the previous round (e.g. "I want to continue playing") is auto-selected when the question is displayed again on a subsequent round.
I'd like to clear the previous answer choice so that no answer choice is auto-selected.
Does anyone know whether this is possible with custom code?
Thanks!

icon

Best answer by rondev 17 May 2020, 18:18

View original

6 replies

Userlevel 7
Badge +22

You can use loop and merge (with 20 loops) and add two question in the block and add display logic to each question as shown below
image.png

Userlevel 1
Badge +6

Is this approach still possible if the game question is located (and I believe must be located) in a separate block from the "next round" question?
After each round of the game is played, an embedded data field ("total1") is set to calculate the participant's total score by summing points from each round of the game. The score will determine whether or not the "next round" questions (continue playing vs stop playing) are displayed. Specifically, the participant wins the game when they've reached over 250 points. At that point, the "next round" block should not be presented, as the participant has won the game.
I've attached an image of my survey flow to display one iteration of the game-next round block cycle (which repeats up to 20 times).
Screen Shot 2020-05-17 at 11.43.41 AM.png

Userlevel 7
Badge +22

"I'd like to clear the previous answer choice so that no answer choice is auto-selected."
Solution:
With reference to your previous approach, the question whether they want to "continue playing" or "stop playing" must be single answer question, just make it multi answer question and make both option exclusive. Now paste the below code in the JS onReady function of this question.
jQuery("#"+this.questionId+" input[type='checkbox']").prop("checked",false);

Userlevel 1
Badge +6

Thanks! Looks like this approach works well.
If I place the JS in the onReady function, the answer choice that was previous selected briefly flashes (as though selected) before being removed. This is undesired because it may prime participants to choose the option that flashes.
If move the JS to the Onload function, that seems to solve the problem. However, I'm wondering if I'm creating unanticipated issues by doing so. In other words, is there a reason the JS must go in the onReady function?

Userlevel 7
Badge +22

Its totally fine to run that in onLoad.

Badge +1

https://www.qualtrics.com/community/discussion/comment/25465#Comment_25465Hi rondev , I have the same issue as Jon , except that the question in the repeated block is a "Text Entry" question.
I did not find anything on the community.
Do you have a proposal for a JScript to solve this issue?
Thanks!

Leave a Reply