Hi!
Well... for sure may be a better/elegant way to solve it , but we just managed to cascade two drop downs this way, the third can be achieved taking into account both previous selections.
You should put this code in the text of the second (& third) drop down, source mode of course, and customize properly (question numbers and limits).
Hope it works for your needs!
Best regards from El Salvador
Code:
//By: corozco@salud.gob.sv / cmartin@salud.gob.sv
//License: GNU/GPL v3 or later
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Initialy hiding all options of filtered question
$('#question30 option').hide();
// Just show the first option: "choose..."
$('#question30 option:eq(0)').show();
// The trigger
$('#question29').on('change',function() {
var value = $(this).find(':selected').val();
var start = 0;
var end = 0;
// Definition of limits
switch (parseInt(value)) {
case 1:
start = 1;
end = 12;
break;
case 2:
start = 13;
end = 21;
break;
case 3:
start = 22;
end = 54;
break;
case 4:
start = 55;
end = 70;
break;
case 5:
start = 71;
end = 92;
break;
case 6:
start = 93;
end = 114;
break;
case 7:
start = 115;
end = 132;
break;
case 8:
start = 133;
end = 158;
break;
case 9:
start = 159;
end = 178;
break;
case 10:
start = 179;
end = 198;
break;
case 11:
start = 199;
end = 210;
break;
case 12:
start = 211;
end = 223;
break;
case 13:
start = 224;
end = 239;
break;
case 14:
start = 240;
end = 262;
break;
default:
start = 0;
end = 0;
break;
}
//alert(value+' '+start+' '+end);
//loop for hiding from the first drop-down item until the first showed
for(i=1; i < start; i++) {
$('#question30 option:eq('+i+')').hide();
}
//loop for showing related items
for(i=start; i <= end; i++) {
$('#question30 option:eq('+i+')').show();
}
//loop for hiding from the last showed til the last option
for(i=end+1; i <= 263; i++) {
$('#question30 option:eq('+i+')').hide();
}
});
});
</script>