Okay, in that case you can add a hidden multiple-options question (qHidden) to control the display of Q2 with an
array filter. A script can auto-check the corresponding option in qHidden if an answer in columns 1 or 2 of Q1 are clicked.
1)
Set up your survey to use JavaScript.
2) Add a multiple-options question (qHidden) to the group containing Q1. Give it the same sub-questions and codes as Q1.
3) Add an
array filter to Q2 based on qHidden.
4) Add the following script to the source of Q1. Replace "11" with the Q1
question ID and "HH" with the qHidden
question ID.
The script:
- Hides the multiple-options question (qHidden)
- Puts a listener on the array cells of Q1.
- If a cell in column 1 or 2 of Q1 is clicked, the corresponding option in qHidden is checked.
- If a cell in any other column of Q1 is clicked, the corresponding option in qHidden is unchecked.
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Call the autoClick function
// Params - Array ID, Hidden question ID, Column of array that auto-checks the hidden question
autoClick(11, HH, 1);
autoClick(11, HH, 2);
function autoClick(qArrayID, qHiddenID, column) {
// Hide the hidden question
$('#question'+qHiddenID+'').hide();
// 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];
}
// Add some column-specific classes
$('#question'+qArrayID+' table.question tr').each(function(i, el){
$('> *', this).each(function(i, el){
$(el).addClass('col-'+i);
});
});
// Add a class to answers that are to auto-check the hidden question
$('#question'+qArrayID+' .col-'+column).addClass('autoClick');
// A listener on the Q1 radio buttons
$('#question'+qArrayID+' table.question tbody td').click(function () {
var rowID = $(this).parents('tbody:eq(0)').attr('id');
var tmp2 = rowID.split('X'+qArrayID);
var answerCode = tmp2[1];
// This cell checks the corresponding option it qHidden
if($(this).hasClass('autoClick')) {
$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', true);
}
// This cell unchecks the corresponding option it qHidden
else {
$('#answer'+sID+'X'+gID+'X'+qHiddenID+answerCode).attr('checked', false);
}
});
}
});
</script>