Welcome, Guest
Username: Password: Remember me

TOPIC: Hiding row in an array type question

Hiding row in an array type question 9 months 2 weeks ago #105838

Hi!

Problem:
- 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!
The administrator has disabled public write access.

Hiding row in an array type question 9 months 1 week ago #105967

  • Bigred
  • Bigred's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 29
  • Thank you received: 10
  • Karma: 2
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;
 
console.log(subNum);
 
	//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: 9 months 1 week ago by Bigred.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.097 seconds
Donation Image