Hiding row in an array type question

3 years 3 weeks ago #105838 by tarantel999

- q1 array with 1-10p. scale
- In q2 show only rows where the respondent has picked 2p. or higher

I've used EM in subquestion, it works well clearing out the row title, but not hide-ing it. Is there an easy way to do it?JavaScript?

{if((q1_A1.NAOK > "2"),Attribute 1,'')}
{if((q1_A2.NAOK > "2"),Attribute 2,'')}
{if((q1_A3.NAOK > "2"),Attribute 3,'')}
{if((q1_A4.NAOK > "2"),Attribute 4,'')}

Thanks in advance!

Please Log in to join the conversation.

3 years 3 weeks ago - 3 years 3 weeks ago #105967 by Bigred01
I just create a hidden multiple choice question with the same amount of subquestions. I will auto answer the corresponding multiple choice option if the array answer is >= 2 then use the build in array filter.

Below is the exact code of a working version I just made. In this example my array subquestions are numbered a1-a5.
$(document).ready(function() {
$('#movenextbtn, #movesubmitbtn').click(function () {
var subNum = 0;
//replace the 5 with the number of array rows you have.
for(var i = 0;i < 5;i++) {
subNum = i + 1;
	//replace "java936471X86X336a" with your id that stores the array value. You will find it under ".answertext". 
	if(document.getElementById('java936471X86X336a'+subNum).value >= "2") {
		//replace the question number with your multiple choice questions number.
		$('#question342 .checkbox:eq('+i+')').attr('checked', true).triggerHandler('click');

In the next question use the SGQA code in the array filter option under advanced settings. Be sure to number them the same.
Last Edit: 3 years 3 weeks ago by Bigred01.

Please Log in to join the conversation.