Hi,
what type of question are you using?
I assume "array(numbers)"?
This is the wrong question type for the wrong script.
This script is used to insert drop-downs into the cells of an "array(text)".
The insertion of the drop-downs work in an array(numbers).
But obviously you will always get the error message, because you do not enter numbers
Did you ever activate this survey to see what is stored?
So the first is:
Use an array(text).
The second:
Use the correct version of the script.
This version of the script stores the
text of the selections.
If you activate the survey and enter some data you will see this in the answer table
But I think you want to store the
values.
To store them you have to use this
(more or less only the part "Returning to page" changed, and some other smaller issues)
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
// Insert selects
$('.answer-item', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Please choose...</option>\
<option value="1">Not at all</option>\
<option value="2">A little </option>\
<option value="3">Somewhat </option>\
<option value="4">Quite a lot </option>\
<option value="5">Very much </option>\
<option value="6">Not applicable </option>\
</select>');
// Listeners
$('.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());
$('select.inserted-select', thisCell).val(inputText);
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
</script>
Joffm