Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Autcomplete error "Uncaught typeError"

Autcomplete error "Uncaught typeError" 2 months 3 weeks ago #109821

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>
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 3 weeks ago #109862

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 3 weeks ago #109894

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!
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 3 weeks ago #109896

The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 3 weeks ago #109905

And this is the link of the file....

gbresearch.net/research/autocomplete/fsa.csv
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 2 weeks ago #109924

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 2 months 2 weeks ago by tpartner.
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 2 weeks ago #109943

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.
Last Edit: 2 months 2 weeks ago by jorge_acevedo.
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 2 weeks ago #109959

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 2 weeks ago #109973

Pardon my ignorance. But how do I do that?
The administrator has disabled public write access.

Autcomplete error "Uncaught typeError" 2 months 2 weeks ago #109992

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.
Last Edit: 2 months 2 weeks ago by jorge_acevedo. Reason: changed mispelling
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image