JS to move matrix answer choices into html table? | XM Community
Question

JS to move matrix answer choices into html table?

  • 25 March 2022
  • 3 replies
  • 51 views

Badge +1

Hello, can anyone provide an example JS of what it would take to move these matrix table answer buttons into the table?
image.png


3 replies

Userlevel 7
Badge +27

Hi there, if you are trying to have it so that respondents are asked the questions "I prefer my community undertake" as well as "The program I think would be more popular in my community is" for each of the 5 program features, you could could present this as 5 different matrix questions that each address a different program feature. Something like:
HiddenScale_Program Features.pngIf the 2 questions are meant to be about the programs overall, I think how you have it is good.

Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/45050#Comment_45050Thanks, Tom. What I am actually trying to do is find JS to move the buttons into the table (I would create new rows), as opposed to having the matrix table below.

Userlevel 7
Badge +27

Ah I see, sounds like you are trying to create buttons in the table that would work the same as selecting the survey question answers. I think that would involve using setChoiceValueByRecodeValue. TomG has an implementation that touches on that in the below thread, changing out what triggers it from the key event to selecting a particular button should work.
https://community.qualtrics.com/XMcommunity/discussion/8897/use-keyboard-for-answering-multiple-choice-question
https://community.qualtrics.com/XMcommunity/discussion/14931/how-to-add-a-custom-button-between-previous-and-next
Alternatively, you could make the whole question look more like its contained within a table by adding a border around the question container, using the below CSS
#Questions{
border: 1px solid black;
}

Leave a Reply