Okay, this should do the trick for an array that uses radio buttons (not
array-multi-flexible-numbers or
array-multi-flexible-text).
Set up your survey to use JavaScript
and place the following script in the source of the multi-option question.
Replace "111" (line 6) with the multi-option question ID and "222" (line 7) with the array question ID.
Note that the answer codes of both questions
MUST be identical
EXCEPT for the answer code of the option that you want permanently displayed.
Code:
<script type="text/javascript" charset="utf-8">
// Filter array by multi-opt but always show default option
$(document).ready(function(){
var q1ID = 111;
var q2ID = 222;
// Find the survey and group IDs
if($( 'input#fieldnames' ).length != 0) {
var fieldNames = $('input#fieldnames').attr('value');
var tmp = fieldNames.split('X');
var sID = tmp[0];
var gID = tmp[1];
}
var optionCode = '';
// Initially hide and clear all unwanted array rows
$('#question'+q1ID+' input.checkbox').each(function(i) {
inputID = $(this).attr('id');
var tmp2 = inputID.split(q1ID);
var optionCode = tmp2[1];
if ($(this).attr('checked') == false) {
$('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').hide();
$('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+' input.radio').each(function(i) {
$(this).attr('checked', false);
});
}
});
// Listener on radio inputs
$('#question'+q1ID+' td.answer, #question'+q1ID+' td.answer input.checkbox').click(function() {
// Hide and clear all unwanted array rows
$('#question'+q1ID+' input.checkbox').each(function(i) {
inputID = $(this).attr('id');
var tmp2 = inputID.split(q1ID);
var optionCode = tmp2[1];
if ($(this).attr('checked') == false) {
$('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').hide();
$('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+' input.radio').each(function(i) {
$(this).attr('checked', false);
});
}
else {
$('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').show();
}
});
});
});
</script>