- Posts: 10633
- Thank you received: 3697
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Autocomplete a question from csv and fill two more question from same CSV
- tpartner
- Away
- LimeSurvey Community Team
Less
More
10 years 9 months ago - 10 years 9 months ago #97120
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 Autocomplete a question from csv and fill two more question from same CSV
Well, I see a few possible problems.
1) This:
Should be
2) This:
Should be
3) Does http://bozpcf/templates/default/php/companies.csv actually exist?
4) It looks like the attached CSV file has the company IDs in the first column and the names in the second but your script indicates that you want them the other way around. The autocomplete function will look at the first column and qCompanyId will be populated from the second column.
1) This:
Code:
var qCompanyName = answer86545X17X536;
Code:
var qCompanyName = $('#answer86545X17X536');
2) This:
Code:
var qCompanyId = answer86545X17X538
Code:
var qCompanyId = $('#answer86545X17X538');
3) Does http://bozpcf/templates/default/php/companies.csv actually exist?
4) It looks like the attached CSV file has the company IDs in the first column and the names in the second but your script indicates that you want them the other way around. The autocomplete function will look at the first column and qCompanyId will be populated from the second column.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 9 months ago by tpartner.
The topic has been locked.
- xsiyez
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
10 years 9 months ago #97139
by xsiyez
Replied by xsiyez on topic Autocomplete a question from csv and fill two more question from same CSV
Hi Tony
Thanks for the response. I have modified the variables as suggested and swapped the column names in the csv.... . The csv actually exists as I can browse to in the browser and can see its output in firebug console when I load the csv url.
However, the error:
Still appears in firebug. I see the complaint in firebug is on
.I only included
from
here
in startpage.pstpl. Do I need to include any other javascript plugin apart from the
plugin and the javascript that I included in the question group?
Thanks for the response. I have modified the variables as suggested and swapped the column names in the csv.... . The csv actually exists as I can browse to in the browser and can see its output in firebug console when I load the csv url.
However, the error:
Code:
TypeError: jQuery.csv is not a function fullArray = jQuery.csv()(data);
Code:
jQuery.csv()
Code:
jquery.csv.js
Code:
jquery.csv.js
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10633
- Thank you received: 3697
10 years 9 months ago #97140
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 Autocomplete a question from csv and fill two more question from same CSV
Can you activate a test survey?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- xsiyez
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
10 years 9 months ago #97147
by xsiyez
Replied by xsiyez on topic Autocomplete a question from csv and fill two more question from same CSV
Please find attached the test survey with other relevant files attached. Kindly change the csv url in the javascript attached to question 1_0 source.
Attachments:
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10633
- Thank you received: 3697
10 years 9 months ago - 10 years 9 months ago #97160
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 Autocomplete a question from csv and fill two more question from same CSV
Ah, I get it now.
You are using a new version of jquery.csv.js, so this:
Needs to be changed to this:
Here is an updated version of your survey with the following changes:
- The script is now in the source of 1_2
- Added a snippet to automatically detect the questions and their text inputs (questions must be sequential)
- The script automatically looks for the CSV file in the template directory
And here is a template with your CSV file and jquery.csv.js in it.
You are using a new version of jquery.csv.js, so this:
Code:
fullArray = jQuery.csv()(data);
Code:
fullArray = $.csv.toArrays(data);
Here is an updated version of your survey with the following changes:
- The script is now in the source of 1_2
- Added a snippet to automatically detect the questions and their text inputs (questions must be sequential)
- The script automatically looks for the CSV file in the template directory
Attachment limesurvey_survey_6928591.lss not found
And here is a template with your CSV file and jquery.csv.js in it.
Attachment test_csv.zip not found
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 10 years 9 months ago by tpartner.
The topic has been locked.
- xsiyez
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
10 years 9 months ago #97167
by xsiyez
Replied by xsiyez on topic Autocomplete a question from csv and fill two more question from same CSV
Thanks a lot Tony!
It has worked. And thanks for the other hints you included in the js file!
Alex
It has worked. And thanks for the other hints you included in the js file!
Alex
The topic has been locked.