Prevent people from changing their response to an MC question | XM Community
Skip to main content

Setup:

  • I have a two-option multiple choice question (pick the red or green button).
  • I have display logic that shows the payout from clicking red or green in page just below the buttons.
  • In the background is a loop & merge that randomly determines a row for the payout (where Field 1 = red payout & Field 2 = green payout). 

I want to prevent people from clicking the red option, seeing the payout, then clicking the green option to see its payout to see which is better. But I do need the payout to appear on the same page. 

Is there a way to prevent people from changing their response to a multiple choice question once they’ve made an initial selection?

 

I assume this needs JS but, unfortunately, I don’t know it!

Thanks!

Use this JS:

Qualtrics.SurveyEngine.addOnload(function() {
var choices = jQuery("#"+this.questionId+" [choiceid]");
choices.click(function() { if(this.checked) choices.not(this).prop("disabled",true); });
});

 


Thanks for the fast reply, @TomG! I really appreciate your help here! :)

Unfortunately, this didn’t solve the problem. I inserted your JS (screenshot below). However, when I preview the survey, I click one option & am still able to click the other option. Perhaps I’ve done something wrong, though?

In case it’s helpful, I’ve included a Word version of the survey here (can’t upload qsf).

Thanks again!

 


Are you using simple layout? There are a bunch of caveats to using JS with simple layout, and it would be much different.


Yes, I am! Strangely, when I was using any other layout, the “display in page” feature for the piped-in value from the L&M was pretty inconsistent in whether or not it displayed. 

Is there either (a) a way to adapt your code for Simple Layout, or (b) a layout that won’t cause the display logic to be so buggy when interacting with the L&M (and enable your code to work as is)?

Thanks, as always, @TomG!


For simple layout it is probably a complete rewrite rather than an adaptation and I don’t have time to look into it.

You’re saying that piping of loop and merge fields (e.g., ${lm://Field/1}) doesn’t work consistently with questions using In-page display logic? Can you provide an example?


Yeah, that’s right! It’s super strange. The survey I attached in the previous comment doesn’t consistently work (i.e., the L&M field doesn’t properly display every loop using in-page display logic) in other Layouts. When I called Qualtrics support, the tech kinda threw up her hands and said, “Yeah, I don’t really understand why this isn’t working.”

Totally understand that this would be too cumbersome. All good, and thanks a ton for your attempt, @TomG. For the benefit of future searchers, I’m going to mark you JS as a working solution since it’s clearly not your fault that the Qualtrics people mucked up JS integration with the Simple Layout.


Leave a Reply