Hi, Mandy,
do I understand this correctly?
You would like to have different options in the drop-downs in one column?
The purpose of an array question is to ask several dimensions on the same set of answers.
Better to split the question (less confusing for the respondents)
You may read this pdf
But anyway. Here you are
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
// Column-specific classes
$('tr.subquestion-list', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
// Insert selects into row 1 / column 1
if($('tr.subquestion-list:eq(0) .answer-item.column-1 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(0) .answer-item.column-1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">Red</option>\
<option value="2">Blue</option>\
<option value="3">Yellow</option>\
</select>');
}
// Insert selects into row 1 / column 2
if($('tr.subquestion-list:eq(0) .answer-item.column-2 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(0) .answer-item.column-2', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">VW</option>\
<option value="2">FORD</option>\
<option value="3">FIAT</option>\
</select>');
}
// Insert selects into row 1 / column 3
if($('tr.subquestion-list:eq(0) .answer-item.column-3 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(0) .answer-item.column-3', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">1</option>\
<option value="2">2</option>\
<option value="3">3</option>\
</select>');
}
// Insert selects into row 2 / column 1
if($('tr.subquestion-list:eq(1) .answer-item.column-1 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(1) .answer-item.column-1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">Yes</option>\
<option value="2">No</option>\
<option value="3">Do not know</option>\
</select>');
}
// Insert selects into row 2 / column 2
if($('tr.subquestion-list:eq(1) .answer-item.column-2 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(1) .answer-item.column-2', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">Option 1</option>\
<option value="2">Option 2</option>\
<option value="3">Do not know</option>\
</select>');
}
// Insert selects into row 2 / column 3
if($('tr.subquestion-list:eq(1) .answer-item.column-3 .inserted-select', thisQuestion).length == 0) {
$('tr.subquestion-list:eq(1) .answer-item.column-3', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">+++</option>\
<option value="2">++</option>\
<option value="3">+</option>\
<option value="4">0</option>\
<option value="5">-</option>\
<option value="6">--</option>\
<option value="7">---</option>\
</select>');
}
// Listeners on select elements
$('.inserted-select', thisQuestion).on('change', function(i) {
if($(this).val() != '') {
$(this).closest('.answer-item').find('input:text').val($('option:selected', this).val()).trigger('change');
}
else {
$(this).closest('.answer-item').find('input:text').val('').trigger('change');
}
});
// Returning to page
$('.with-select input:text', thisQuestion).each(function(i) {
var thisCell = $(this).closest('.answer-item');
var inputText = $.trim($(this).val());
var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
$('select.inserted-select', thisCell).val(selectval);
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
</script>
Here the rows and columns are "counted", so independent from your codes.
columns in the loop at the beginning of the script -> classes "column-1", "column-2", ...
rows by "eq(0)", "eq(1)", ... (index starts with 0)
And the sample survey.
Regarding your quota. This is absolutely correct; you should change the quita message.
But remember: A quota can only work in active surveys.
Easy to understand: How can a quota of e.g. 50 men / 50 women work, if there are no data stored?
Joffm
And I found this below, it seems not applied in Version 3.25.20
Oh, you found it.
Where? In front of the bakery in Marnixlaan?
A bit more information would have been appreciated