Data Punching in Hidden Variable (Multi response) using "setChoiceValue" function | XM Community
Skip to main content
Question

Data Punching in Hidden Variable (Multi response) using "setChoiceValue" function

  • August 21, 2019
  • 3 replies
  • 157 views

Q1- I am new to this tool. i am trying to set the data on the dummy variable. I've used carry forward functionality. So the total no of categories displayed should be set in hidden variable. We've used the below code for the same. But the problem is when we test it using back and forwarding the survey it does not work for few cases. We are not sure why this is happening. Please suggest. code is below - if (this.getChoiceDisplayed("x1")) { this.setChoiceValue("x1",true) ;} if (this.getChoiceDisplayed("x2")) { this.setChoiceValue("x2",true) ;} if (this.getChoiceDisplayed("x3")) { this.setChoiceValue("x3",true) ;} Q2- Also, is there any way to show the question in read Only mode, so that we can show our hidden question in the survey for testing purpose?

3 replies

  • August 21, 2019
Q1 - I tried the below code and worked perfect. Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ var choiceInputs = this.getChoices(); var i=0; for (i = 0; i < choiceInputs.length; i++) { this.setChoiceValue(choiceInputs[i], true); } }); Q2- i am not sure how to do it. Still learning..

  • Author
  • September 3, 2019
Arvind, thanks for the response! that helps.

Forum|alt.badge.img+18
  • Level 3 ●●●
  • September 3, 2019
For second point you can use css\\js to make question readonly. Relevant discussion was done on:- https://www.qualtrics.com/community/discussion/comment/17117#Comment_17117