How to record data in hidden question | XM Community
Skip to main content

I would like to know how to automatically capture or record the answers provided in Question 1 (Q1) and transfer them to Question 2 (Q2), which is currently a hidden question.

 

In Q1, respondents are asked to input their age using a text entry field.

 

In Q2, I aim to categorize age groups based on the input from Q1, and make Q2 a hidden question.

 

 

@hachiware10 Add this JS to your Q2

Qualtrics.SurveyEngine.addOnload(function()
{
var Q1 = '${q://QID1/ChoiceTextEntryValue}';
if ( Q1<= 17){
this.setChoiceValueByRecodeValue(1,'true');}
if ( Q1 >= 18 && Q1 <= 19){
this.setChoiceValueByRecodeValue(2,'true');}
if ( Q1 >= 20 && Q1 <= 24){
this.setChoiceValueByRecodeValue(3,'true');}

.............
<<Complete the rest........

});

Change QID of Q1 according to yours and complete the rest of the code. Hope this helps


Thank you @dxconnamnguyen !


@hachiware10 Glad to help 😊


Leave a Reply