I recently switched over to 2.0.5, and an old questionnaire of mine no longer works.
I have a question (q1) that has a list of 36 locations.
I have a question (q7) that has 26 items, which vary because each of the different locations may have a separate subset of them.
What I used to use (thanks to tpartner) is a hidden question underneath q1 which would check off the items that each location might have, and then that would filter q7. Unfortunately, it is not working. Here is the javascript that would go into the question, I was wondering if anyone can help me update it.
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
//THIS IS THE AT-CENTER VERSION
// The question IDs
var q1 = 1;
var qHidden = 40;
// Hide the hidden question
$('#question'+qHidden+'').hide();
// Assign classes to the inputs
$('#question'+q1+' input.radio').each(function(i) {
$(this).addClass('q1Row'+(i+1)+'');
});
$('#question'+qHidden+' input.checkbox').each(function(i) {
$(this).addClass('qHiddenRow'+(i+1)+'');
});
// Interrupt the Next/Submit function
$('form#limesurvey').submit(function(){
// Reset the hidden question
$('#question'+qHidden+' input.checkbox').attr('checked', false);
// If q1 row 1 is checked we do this
if($('.q1Row1').attr('checked') == true) {
$('.qHiddenRow1').attr('checked', true);
$('.qHiddenRow2').attr('checked', true);
$('.qHiddenRow3').attr('checked', false);
$('.qHiddenRow4').attr('checked', true);
}
if($('.q1Row2').attr('checked') == true) {
$('.qHiddenRow1').attr('checked', false);
$('.qHiddenRow2').attr('checked', true);
$('.qHiddenRow3').attr('checked', true);
$('.qHiddenRow4').attr('checked', true);
}
// Carry on with submit
return true;
});
})
</script>