side by side text boxes for one question? | XM Community
Skip to main content
Solved

side by side text boxes for one question?

  • January 28, 2021
  • 2 replies
  • 144 views

How can I have two side by side text boxes for one question with texts in between, e.g., (_____ out of ____ )? Thanks in advance!

Best answer by ahmedA

This isn't possible using the default Qualtrics settings. However, you can use elements in the question in HTML and then store their value using embedded data. This is the demo for the code below:
Question HTML:
Please enter your value


Out of

Question JS:
Qualtrics.SurveyEngine.addOnPageSubmit(function(){
var my_val = this.getQuestionContainer().querySelector("#my_val").value;
var max_val = this.getQuestionContainer().querySelector("#max_val").value;

Qualtrics.SurveyEngine.setEmbeddedData("my_val", my_val);
Qualtrics.SurveyEngine.setEmbeddedData("max_val", max_val);
});

2 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • January 31, 2021

This isn't possible using the default Qualtrics settings. However, you can use elements in the question in HTML and then store their value using embedded data. This is the demo for the code below:
Question HTML:
Please enter your value


Out of

Question JS:
Qualtrics.SurveyEngine.addOnPageSubmit(function(){
var my_val = this.getQuestionContainer().querySelector("#my_val").value;
var max_val = this.getQuestionContainer().querySelector("#max_val").value;

Qualtrics.SurveyEngine.setEmbeddedData("my_val", my_val);
Qualtrics.SurveyEngine.setEmbeddedData("max_val", max_val);
});


  • Author
  • February 3, 2021

Thank you ahmedA ! Your solution perfectly solved this problem!