Autcomplete error "Uncaught typeError"

Mehr
3 Jahre 7 Monate her #109821 von jorge_acevedo
jorge_acevedo erstellte das Thema Autcomplete error "Uncaught typeError"
Hi!

I've been using the autocomplete for quite a while already but for some reason it has stopped working. I went to the limesurvey workarounds manual and updated the script I was using but still get the following error:

fullArray = $.csv.toArrays(data);
Uncaught TypeError: Cannot read property 'toArrays' of undefined.


Thanks for your help!!


The whole code I am using is the following:


<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

// Define the CSV filename
var csvName = 'fsa.csv';

// Define some paths
var surveyRoot = location.pathname.split('index.php')[0];
// var templateName = $('head link[href*="template.css"]').attr('href').replace(/\/template.css/, '').split('/templates/')[1];
var csvPath = surveyRoot+'autocomplete/';

// Define the questions
var q1ID = '{QID}';
var q1 = $('#question'+q1ID);
// var q2 = $(q1).nextAll('.text-short:eq(0)');
// var q3 = $(q1).nextAll('.text-short:eq(1)');

// Define the path to the CSV
var url = csvPath+csvName;

// Create an array to hold the CSV rows
var namesArr = new Array();

// Grab the CSV contents
$.get( url, function( data ){

// Convert CSV contents to an array of arrays
fullArray = $.csv.toArrays(data);
// Load the CSV rows array
$(fullArray).each(function(i, item){
namesArr.push(item[0]);
});

// Initialise the autocomplete plugin
$('input.text', q1).autocomplete({
source: namesArr,
});
});
});
</script>

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109862 von tpartner
tpartner antwortete auf das Thema: Autcomplete error "Uncaught typeError"
It doesn't look like the CSV contents are being imported correctly.

What changes were made to the installation before the error appeared?


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109894 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"
Hi Tony,
Thanks for your response.

I just updated limesurvey. I also changed the survey template. But I moved everything as it should be. And I don't get an error of not finding the csv.

I'll provide a link to a test question later today for you to look at.

Thanks!

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109896 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109905 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"
And this is the link of the file....

gbresearch.net/research/autocomplete/fsa.csv

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her - 3 Jahre 7 Monate her #109924 von tpartner
tpartner antwortete auf das Thema: Autcomplete error "Uncaught typeError"
A couple of things to check...

1) This line should have a lower-case v in "Var"
Var url = "research/autocomplete/fsa.csv";

2) Because you are using a subdomain, the URL defined in that line leads to research.gbresearch.net/research/autocomplete/fsa.csv which doesn't exist. I think the defined URL should simply be "autocomplete/fsa.csv".


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Letzte Änderung: 3 Jahre 7 Monate her von tpartner.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her - 3 Jahre 7 Monate her #109943 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"
I changed it as suggested but still not working.

Any more suggestions?

I would think it stopped working when we changed the limesurvey from gbresearch.net/research to research.gbresearch.net

Do you think it could be the problem? Yet, it seems it finds the file correctly.
Letzte Änderung: 3 Jahre 7 Monate her von jorge_acevedo.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109959 von tpartner
tpartner antwortete auf das Thema: Autcomplete error "Uncaught typeError"
Try using an absolute path to the CSV.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109973 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"
Pardon my ignorance. But how do I do that?

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her - 3 Jahre 7 Monate her #109992 von jorge_acevedo
jorge_acevedo antwortete auf das Thema: Autcomplete error "Uncaught typeError"
Tony,

Just wanted to let you know that I was able to fix it.

What I did:

I was using the jquery.csv.js version .5 that is posted on the limesurvey wiki
code.google.com/p/jquery-csv/source/brow...77f1d747bc860b943fe7

Apparently that's an old code.

I found in google a new version 0.71

code.google.com/p/jquery-csv/downloads/d...csv-0.71.js&can=2&q=

I replaced the old version for the new one and my autocomplete started working!!!


Thanks for your support.
Letzte Änderung: 3 Jahre 7 Monate her von jorge_acevedo. Begründung: changed mispelling

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 7 Monate her #109998 von tpartner
tpartner antwortete auf das Thema: Autcomplete error "Uncaught typeError"
Thanks. I've updated the links on the Workaround page.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha