Hiding specific columns in a side-by-side Question and applying force response | Experience Community
Skip to main content
Solved

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

  • Dec 17, 2018 10:09 AM UTC
  • 6 replies
  • 290 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 !

Best answer by TomG

@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(); ```
View original

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Dec 17, 2018 1:33 PM UTC
@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(); ```

  • Author
  • Dec 17, 2018 5:19 PM UTC
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

  • Author
  • Dec 18, 2018 8:23 AM UTC
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

MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • Aug 10, 2020 12:51 PM UTC

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


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Aug 10, 2020 12:57 PM UTC

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.


MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • Aug 11, 2020 12:00 PM UTC

Thanks Tom