Hi,
I have two multiple choice list questions:
* Q1 is a Multiple choice list on page 1 (Group 1);
* Q2 is a Multiple choice with comments on page 2 (Group 2)).
I need to ask another multiple choice question Q3 on page 2 (Group 2), that would show a combination of selections from both Q1 and Q2. This Q3 will then be used as a (hidden) array filter for other questions. So, my questions:
1. Can it be done with built-in array filter functionality somehow?
My guess is that it CAN'T be done, so:
2. I tried using JavaScript and while I was able to "tick" the boxes in Q3 using answers from Q2 (with some javascript inside Q3), I can't do the same for Q2 answers. My javascript fails executing the following line and as a result the whole code section fails:
Code:
//this fails
var dir = '{Q2_SQ001.NAOK}';
This is the code inserted into Q2 on Page 2 (Group 2):
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Identify this question
var thisQuestion = $('#question{QID}');
// Assign event function to comment boxes
$('input[type="text"]', thisQuestion).on('change', function() {
var targetQuestion = $('#question3'); // this is Q3 reference
var dir = '{Q2_SQ001.NAOK}';
});
});
</script>
It seems the problem is in Q2 being on the same page where I try to run this code (i.e. same page as Q3), but I have no ideas for alternatives. I can't put Q2 and Q3 on separate pages.