- Posts: 1
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Limesurvey 5.2.12 autocomplete csv
1 year 1 month ago #224621
by djimas
Limesurvey 5.2.12 autocomplete csv was created by djimas
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Theme:
==================
Hi ,
Someone I can explain me how to configure autocomplete in limesurvey release 5.2.12 ?
I followed this tutorial, is valid for this release 5.2.12 ?
manual.limesurvey.org/Workarounds:_Manip...ulate_several_fields
I put the javascript code in source the first question and the csv is load perfectly into javascript array but autcomplete doesn't work:
<link href="/upload/templates/test/template.css" rel="stylesheet" />
<script type="text/javascript" src="/upload/templates/test/jquery-ui-1.13.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="/upload/templates/test/jquery.csv.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var qNameID = 16;
var qIDID = 17;
var qEmailID = 18;
var url = "/upload/templates/test/names.csv";
// Create an array to hold the names
var namesArr = new Array();
// Grab the CSV contents
$.get(url,function(data){
// Convert CSV contents to an array of arrays
fullArray = $.csv.toArrays(data);
alert(data);
// Load the names array
$(fullArray).each(function(i, item){
namesArr.push(item[0]);
});
// Initialise the autocomplete plugin
$('#question'+qNameID+' input.text').autocomplete({
source: namesArr,
// Event fired when a selection is made (ui.item.value refers to the selected item)
select: function(event, ui) {
// Find the "ID" and "Email" values associated with the selected name value and load those questions
$(fullArray).each(function(i, item){
if(item[0] == ui.item.value) {
// The value from column 2 of the CSV
$('#question'+qIDID+' input.text').val(item[1]);
// The value from column 3 of the CSV
$('#question'+qEmailID+' input.text').val(item[2]);
}
});
}
});
});
});
</script>
thanks in advance,
Dani
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Theme:
==================
Hi ,
Someone I can explain me how to configure autocomplete in limesurvey release 5.2.12 ?
I followed this tutorial, is valid for this release 5.2.12 ?
manual.limesurvey.org/Workarounds:_Manip...ulate_several_fields
I put the javascript code in source the first question and the csv is load perfectly into javascript array but autcomplete doesn't work:
<link href="/upload/templates/test/template.css" rel="stylesheet" />
<script type="text/javascript" src="/upload/templates/test/jquery-ui-1.13.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="/upload/templates/test/jquery.csv.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var qNameID = 16;
var qIDID = 17;
var qEmailID = 18;
var url = "/upload/templates/test/names.csv";
// Create an array to hold the names
var namesArr = new Array();
// Grab the CSV contents
$.get(url,function(data){
// Convert CSV contents to an array of arrays
fullArray = $.csv.toArrays(data);
alert(data);
// Load the names array
$(fullArray).each(function(i, item){
namesArr.push(item[0]);
});
// Initialise the autocomplete plugin
$('#question'+qNameID+' input.text').autocomplete({
source: namesArr,
// Event fired when a selection is made (ui.item.value refers to the selected item)
select: function(event, ui) {
// Find the "ID" and "Email" values associated with the selected name value and load those questions
$(fullArray).each(function(i, item){
if(item[0] == ui.item.value) {
// The value from column 2 of the CSV
$('#question'+qIDID+' input.text').val(item[1]);
// The value from column 3 of the CSV
$('#question'+qEmailID+' input.text').val(item[2]);
}
});
}
});
});
});
</script>
thanks in advance,
Dani
Please Log in to join the conversation.
- test_user_4
-
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
10 months 1 week ago #228309
by test_user_4
Replied by test_user_4 on topic Limesurvey 5.2.12 autocomplete csv
I am also trying to get this to work. How did you upload the jquery.csv.js plugin? I'm using LimeSurvey 3x. If I can get that loaded I'll see if I can get it to work.
Please Log in to join the conversation.
10 months 1 week ago #228323
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Limesurvey 5.2.12 autocomplete csv
If you don't have direct server access, you may be able to load it via CDN -
cdnjs.com/libraries/jquery-csv
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.