Hi,
I am not sure if this is the right place to put my question. It seems a bug.
I have to two array questions.
The first is an array text question with both dropdown and "+""-" button.
I use scripts from this forums to add drop-list (Please see the script below) and use scripts from this link
www.limesurvey.org/manual/Workarounds:_M...ble_Text.29_question
to add "+""-" button.
Script to add drop-list:
<script>
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
$('tr.subquestion-list', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
//c3
if($('.answer-item.column-3 .inserted-select', thisQuestion).length == 0) {
$('.answer-item.column-3', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">--Choose house type--</option>\
<option value="1">House</option>\
<option value="2">Apartment</option>\
<option value="3">Dormitory</option>\
</select>');
}
//L
$('.inserted-select', thisQuestion).on('change', function(i) {
var thisInput = $(this).closest('.answer-item').find('input:text');
if($(this).val() != '') {
$(thisInput).val($.trim($('option:selected', this).text()));
checkconditions( $(thisInput).attr('value'), $(thisInput).attr('name'), 'text');
}
else {
$(thisInput).val('');
checkconditions( $(thisInput).attr('value'), $(thisInput).attr('name'), 'text');
}
});
//R
$('.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);
});
// C
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
</script>
The first question(Q1) looks like:
The second question(Q2) is a normal array question. I set conditions for subquestions so that subquestions will be shown only when the respondent doesn't choose "Dormitory" in the first question. For example, in the Q1, I choose "Apartment" for the first row and choose "Dormitory" for the second row. In the Q2, only the first row will be shown. It looks like:
The problem appears when I click "+""_" repeatedly.
For example:
1. I fill in two rows in Q1
2. I click "-" then "+"
Only the first cell shows empty so I fill this cell again and click "Next".
3. I go to the second question and it shows two rows (please see the picture below). But it is wrong because I choose "Dormitory" for the second row in Q1, the second row in Q2 should not be shown. In other words, that answer in Q1 is not recorded. It's a very big problem for me.
I hope I have explained my question clearly. Can anyone help? Thank you very much!
I am using LS 3+