Hi,
I achieved to build a autocomplete question with this forum entry:
www.limesurvey.org/forum/can-i-do-this-w...esurvey-3-6-1#166770
Joffm helped me that the autocomplete question shows different autocomplete suggestions based on the answer of a previous question. In my first question I ask in which state the respondent live. In my second question I ask in which municipality the respondent live. The autocomplete shows only those municipalities that belong to the previous answered state.
However, this autocomplete feature only works if the question which asks about the state is on a different survey page than the question which asks about the municipality. Is there a way having both question on the same survey page and autocomplete still works?
This is the javascript of the autocomplete question:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var qID = {QID};
var surveyRoot = location.pathname.split('index.php')[0];
var url = surveyRoot+"upload/themes/survey/extends1_bootswatch/gemeindenamen_liste{Q1}.csv";
// Create an array to hold the data
var province= new Array();
// Grab the CSV contents
$.get(url,function(data){
// Convert CSV contents to an array of arrays
fullArray = $.csv.toArrays(data);
// Load the data array
$(fullArray).each(function(i, item){
province.push(item[0]);
});
// Initialise the autocomplete plugin
$('#question'+qID+' input[type="text"]').autocomplete({
source: province
});
});
});
</script>
I attached a small test survey (.lss) and a theme (.zip) with this problem.
Limesurvey Version: 3.14