Hi, Joff!
What I have to do:
Q1 (single) City
Q2 (multiple) Brands ever used, each city has a list of brands that are present
BUC : 'CL1,CL3,CL5',
BV : 'CL1,CL2,CL3,CL4',
IS : 'CL2,CL3,CL4,CL5',
TM : 'CL1,CL4,CL6'
Q3 (single) Brand used most often - show only the brands that are ticked in Q2
I tried to implement the scripts in my survey and the version that finally worked for me was:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// The Q2 options corresponding to the Q1 options
ListaClinici = {
BUC : 'CL1,CL3,CL5',
BV : 'CL1,CL2,CL3,CL4',
IS : 'CL2,CL3,CL4,CL5',
TM : 'CL1,CL4,CL6'
};
// Identify this question
var thisQuestion = $('#question{QID}')
// The checked option in Q1
var q1Ans = '{Q1}';
// Hide all of the clinics
$('.answer-item', thisQuestion).hide();
// Now show the appropriate ones
$(ListaClinici[q1Ans].split(',')).each(function(i){
$('.answer-item[id$="'+{QID}+this+'"]').show();
});
// Uncheck all hidden radios (in case page has been seen before)
$('.answer-item:hidden input.radio', thisQuestion).prop('checked', false);
});
</script>
Now, I have the following situation:
In Q3, i need to show only the brands that are ticked in Q2 (multiple answer). I put the array filter and it doesn't work properly, it doesn't show the correct list of chosen answers in Q2. For some cities it works, for some other it doesn't.
I also attach the survey, I think it is something I miss here! Can you have a look on the syntax?
Many many thanks! [attachment=11079]Clinics test adina.lss
The topic has been locked.