Create text boxes in a matrix question for respondents who select "other" | XM Community
Solved

Create text boxes in a matrix question for respondents who select "other"

  • 17 June 2021
  • 5 replies
  • 789 views

Userlevel 2
Badge +1

Hi,
I have a matrix question which has four lines (statements). The statements have linked to other questions (display logic). My question is how do create text boxes that allow respondent to fill in answer which are not in my list? Please see the picture below.
image.png
Please help! I need this issue to be solved urgently!
I appreciate your response!

Regards,
Houston

icon

Best answer by ahmedA 18 June 2021, 03:55

View original

5 replies

Userlevel 5
Badge +11

https://community.qualtrics.com/discussion/16695/create-text-boxes-in-a-matrix-question-for-respondents-who-select-otherI'm not sure if it is possible in matrix question but you could try using Side by Side question type. Just reduce the number of answer columns in each column
Screenshot (9)_LI.jpg

Userlevel 2
Badge +1

Hi Eumetis,
Thank you for giving me your suggestion. I tried side by side question, unfortunately, it does not work as I have only one question and the question has four alternatives to select, "other", is one of four alternatives. I would like respondents to specify the system they use rather than just tick "other". That's why I want to change the dot "o" into a text box.
Is that possible?
I appreciate your effort and help. Many thanks.
Regards,
Houston

Userlevel 7
Badge +21

You can use this JS:
Qualtrics.SurveyEngine.addOnReady(function () {
    document.querySelectorAll("td.last").forEach((item) => {
        let sl = item.querySelector("[type='radio']");
        item.querySelectorAll("*").forEach((child) => child.hide());
        item.insertAdjacentHTML(
            "afterbegin",
            ""
        );
        document.querySelector("#other_text_" + sl.name.split("~")[2]).oninput = function (e) {
            if (e.target.value.trim() !== "") sl.checked = true;
        };
    });
    document.querySelector("#NextButton").onclick = function () {
        document.querySelectorAll("[id^='other_text_']").forEach((tb) => {
            Qualtrics.SurveyEngine.setEmbeddedData(tb.id, tb.value);
        });
    };
});
You'll need to create ED for each choice like other_text_1, other_text_2 etc.

Userlevel 2
Badge +1

Hi ahmedA,
The JS works well. However, could you please explain the following statement clearly please?
"You'll need to create ED for each choice like other_text_1, other_text_2 etc."
I have not idea what are there?
Thanks!
Regards,
Houston

Userlevel 7
Badge +21

ED stands for embedded data, read the support pages on how to create them.
Since the matrix question only stores radio boxes, you need some place to store the text people will be putting in it. Hence, ED.

Leave a Reply