Hiding scale points based on a condition | XM Community
Solved

Hiding scale points based on a condition


Userlevel 2
Badge +6

I have seen a few posts about this already but my rows are randomized so I cannot just go to a specific row and hide a scale point. I have a 0-10 satisfaction scale with a Not applicable. I have close to 20+ rows and I only need to enable the "Not applicable" to 4 of them. How can I do this if rows are randomized?

icon

Best answer by SurajK 26 June 2020, 01:19

View original

2 replies

Userlevel 7
Badge +22

Instead of custom code, we can also use custom validation and add validation as for those other 16 rows "Not applicable is not selected"

Userlevel 5
Badge +4

Add those text in span class with some class name (like in below code "op1, op2, op3..") where you need to show the radio buttons and do not add any span class for other options
And add the below codes as per your matrix layout,
// If you have applied border to matrix question
jQuery('tbody tr').find('td:last-child').each(function(){
jQuery(this).find('.q-radio').css('visibility','hidden')
})


jQuery('.op1').closest('tr').find('td:last-child').find('.q-radio').css('visibility','visible')
jQuery('.op2').closest('tr').find('td:last-child').find('.q-radio').css('visibility','visible')
jQuery('.op3').closest('tr').find('td:last-child').find('.q-radio').css('visibility','visible')
jQuery('.op4').closest('tr').find('td:last-child').find('.q-radio').css('visibility','visible')


// If you don't borders applied to matrix question
jQuery('tbody tr').find('td:last-child').each(function(){
jQuery(this).css('visibility','hidden')
})


jQuery('.op1').closest('tr').find('td:last-child').css('visibility','visible')
jQuery('.op2').closest('tr').find('td:last-child').css('visibility','visible')
jQuery('.op3').closest('tr').find('td:last-child').css('visibility','visible')
jQuery('.op4').closest('tr').find('td:last-child').css('visibility','visible')

Leave a Reply