Hiding specific columns in a side-by-side Question and applying force response | XM Community
Solved

Hiding specific columns in a side-by-side Question and applying force response

  • 17 December 2018
  • 6 replies
  • 115 views

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 !
icon

Best answer by TomG 17 December 2018, 14:33

View original

6 replies

Userlevel 7
Badge +27
@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();
```
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
Userlevel 4
Badge +14

https://www.qualtrics.com/community/discussion/comment/9772#Comment_9772Can I use this approach to hide a column in a Matrix Table?

Userlevel 7
Badge +27

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.

Userlevel 4
Badge +14

Thanks Tom

Leave a Reply