So, hier kommt das Beispiel
Ich habe einmal zwei "Sonstige" vorgesehen.
Im script siehst Du, wie Du dies reduzieren bzw. erweitern kannst.
Nun kann der Teilnehmer anchecken, was er will, oder auch nicht.
Solltest Du trotzdem eine exclusive Spalte "weder/noch" hinzufügen wollen,
füge dieses script hinzu
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Call the exclude function using question ID
excludeOpt({QID});
});
// A function to make the last option in each array row exclusive
function excludeOpt (qID) {
var thisQuestion = $('#question'+qID)
// Add some classes to the checkbox cells
$('td.checkbox-item', thisQuestion).addClass('normal-item');
$('tr.subquestion-list', thisQuestion).each(function(i) {
$('.normal-item:last', this).removeClass('normal-item').addClass('exlusive-item')
});
// A listener on the checkboxes
$('input[type="checkbox"]', thisQuestion).on('change', function (event) {
handleExclusive($(this).closest('td'));
});
function handleExclusive(thisCell) {
var thisRow = $(thisCell).closest('tr');
// Uncheck the appropriate boxes in a row
if ($(thisCell).hasClass('normal-item')) {
$('.exlusive-item input[type="checkbox"]', thisRow).prop('checked', false);
}
else {
$('.normal-item input[type="checkbox"]', thisRow).prop('checked', false);
}
// Check conditions (relevance)
$('td.checkbox-item', thisRow).each(function(i) {
var thisValue = '';
if($('input[type="checkbox"]', this).is(':checked')) {
thisValue = 1;
}
var thisSGQA = $('input[type="checkbox"]', this).attr('id').replace(/cbox_/, '');
$('input[type="hidden"]', this).attr('value', thisValue);
fixnum_checkconditions(thisValue, thisSGQA, 'hidden');
});
}
}
</script>
Prinzipiell bin ich kein besonderer Freund von "Sonstigen" in Matrizen, die bereits precodes enthalten.
Schwierig auszuwerten (verschiedene Basen), viele "laufende Läuse", usw.
Stattdessen ist es m.E. besser, einfach ansdchließend zwei offene Textfragen zu stellen.
"Gibt es andere Aspekte, die gegenwärtig relevant sind?"
"Gibt es andere Aspekte, die zukünftig relevant sein können?"
Aber natürlich: Up to you.
Joffm