Context: I have a side by side question, where users have to rank from 1-4 for various cars on different parameters!
Now I have a multiple choice question to capture which cars are owned by the respondent - I have to hide the respective columns based on response from multiple choice question
Thanks to @TomG, I have read many of his previous answers and my approach here is:
1. Capture the response from the multiple choice as embedded/ piped text
2. use Javascript to hide the respective cells - $('QR~' + qid +'#2~1~1').up('td').childElements().invoke('hide'); - and header - $('question2QID417' ).childElements().invoke('hide') -
!
I have applied force response for the entire side-by-side question; when I hide some of the columns, the question still prompts for some response for the hidden columns. I guess this can be handled by
1. auto-populating the hidden columns with dummy values in the side-by-side question - Please advise how this can be done
Also, can someone validate this approach for hiding selective column is correct / is there a much simpler option for this !
Page 1 / 1
@KumarA_156,
There are a couple of different ways you could do it. You could turn off force response, and use Custom Validation instead. Or you could write JavaScript to automatically select NA for all the dropdowns when that column is hidden.
An easier way to hide a column is (e.g. column 4):
```
jQuery("#"+this.questionId+" .SBS4").hide();
```
There are a couple of different ways you could do it. You could turn off force response, and use Custom Validation instead. Or you could write JavaScript to automatically select NA for all the dropdowns when that column is hidden.
An easier way to hide a column is (e.g. column 4):
```
jQuery("#"+this.questionId+" .SBS4").hide();
```
Thanks a lot @TomG . Can you help me with how to automatically select "NA" for all the dropdowns when that coloumn is hidden ( Sorry, I am new to Javascript - and not able to get that in my research - I experimented with " jQuery("#"+this.questionId+" .SBS4").val("1").change();" , but it is not working
Found a solution to automatically pass values to an element -
document.getElementById("QR~<questionid>#1~1").value = "5"; ( 5 corresponds to the choice NA)
Thanks @TomG
document.getElementById("QR~<questionid>#1~1").value = "5"; ( 5 corresponds to the choice NA)
Thanks @TomG
https://www.qualtrics.com/community/discussion/comment/9772#Comment_9772Can I use this approach to hide a column in a Matrix Table?
https://www.qualtrics.com/community/discussion/comment/28845#Comment_28845Yes, but the class names for a matrix are different:
jQuery("#"+this.questionId+" .c4").hide();
Where c4 is the class of the 1st column, c5 the 2nd column, etc.
Thanks Tom
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.