In a side-by-side matrix, I am hiding some columns (depending on the inputs from previous responses) - is there a way to automatically select some values for all the hidden columns ?
Page 1 / 1
what are the question types and why would you want to?
@RDurant - I have 1 side-by-side question and 1 multiple choice question and I want to capture the responses of both the questions for using it in the javascript code of other questions
@KumarA_156 I meant the question types inside of the side-by-side, sorry for not clarifying. Is your side-by-side all drop down, radio, checkbox, text, etc. If you are trying to assign default values from the hidden columns I'm pretty sure there is in option for that right in Qualtrics no need for JavaScript.
If you are trying to pull the value out of side-by-side data you could try something like this.
You'll have to inspect the side-by-side in preview mode to get the id of the responses as they will be different for each type of question, but it should look something like this. Mine was inside of a loop and merge so I have an extra variable that you may not.
//this will select the element of the response
var c5V= document.getElementsByName('QR~1_QID164#2~1'); //'QR~LOOPNUMBER_QUESTIONID#COLUMN~ROW~SELECTION'
//this will loop all the radio options in the element (assuming it is a radio type)
for(var i = 0; i < c5V.length; i++){
if(c5V[i].checked){
c5Val = c5V[i].value;
}
//c5Val will be the value of the radio button that is selected.
If you are trying to pull the value out of side-by-side data you could try something like this.
You'll have to inspect the side-by-side in preview mode to get the id of the responses as they will be different for each type of question, but it should look something like this. Mine was inside of a loop and merge so I have an extra variable that you may not.
//this will select the element of the response
var c5V= document.getElementsByName('QR~1_QID164#2~1'); //'QR~LOOPNUMBER_QUESTIONID#COLUMN~ROW~SELECTION'
//this will loop all the radio options in the element (assuming it is a radio type)
for(var i = 0; i < c5V.length; i++){
if(c5V[i].checked){
c5Val = c5V[i].value;
}
//c5Val will be the value of the radio button that is selected.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.