- Posts: 153
- Thank you received: 8
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
autocomplete suggestions with csv file based on a previous question on same page
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
5 years 4 months ago #176848
by KompetenzZ
Cheers kompetenzz
autocomplete suggestions with csv file based on a previous question on same page was created by KompetenzZ
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:
I attached a small test survey (.lss) and a theme (.zip) with this problem.
Limesurvey Version: 3.14
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
Cheers kompetenzz
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 4 months ago #176859
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic autocomplete suggestions with csv file based on a previous question on same page
Just for information :
gitlab.com/SondagesPro/QuestionSettingsType/autoComplete
I need to put a demo … and some README … i make it this afternoon …
Use a short text question for autocomplete with a csv file, allowing filter by expression manager
I need to put a demo … and some README … i make it this afternoon …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago #177042
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic autocomplete suggestions with csv file based on a previous question on same page
Thank you for uploading the README.md on
gitlab.com/SondagesPro/QuestionSettingsType/autoComplete
Regarding csv file upload, it is said there:
"this csv file must be uploaded in ressources files of the survey"
So I placed the csv file there:
/upload/themes/survey/yourThemeName/autocomplete_list.csv
And I also tried it there:
/upload/themes/survey/yourThemeName/files/autocomplete_list.csv
The plugin seems to do nothing. Could it be that I use the wrong file location?
In the edit question option I set the "CSV file to be used" to: autocomplete_list
Regarding csv file upload, it is said there:
"this csv file must be uploaded in ressources files of the survey"
So I placed the csv file there:
/upload/themes/survey/yourThemeName/autocomplete_list.csv
And I also tried it there:
/upload/themes/survey/yourThemeName/files/autocomplete_list.csv
The plugin seems to do nothing. Could it be that I use the wrong file location?
In the edit question option I set the "CSV file to be used" to: autocomplete_list
Cheers kompetenzz
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
5 years 4 months ago - 5 years 4 months ago #177045
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 suggestions with csv file based on a previous question on same page
I think it should be:
/upload/surveys/[SurveyID]/autocomplete_list.csv
or
/upload/surveys/[SurveyID]/files/autocomplete_list.csv
/upload/surveys/[SurveyID]/autocomplete_list.csv
or
/upload/surveys/[SurveyID]/files/autocomplete_list.csv
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 4 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago - 5 years 4 months ago #177046
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic autocomplete suggestions with csv file based on a previous question on same page
Thank you. That is strange, I do not have the folder "surveys". Should I create this folder?
I looked on Github: github.com/LimeSurvey/LimeSurvey
There is a ".htaccess" file inside the folder "/upload/surveys/". Should I copy this file to the new created folder?
LS Version 3.14.11+180926
I looked on Github: github.com/LimeSurvey/LimeSurvey
There is a ".htaccess" file inside the folder "/upload/surveys/". Should I copy this file to the new created folder?
LS Version 3.14.11+180926
Cheers kompetenzz
Last edit: 5 years 4 months ago by KompetenzZ.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 4 months ago - 5 years 4 months ago #177047
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic autocomplete suggestions with csv file based on a previous question on same page
I choose this place because it can be uploaded by the Survey admin even if he don't have rights on Theme (and no FTP access)
Survey menu / Resources
or Insert link in HTML editor
I test the system with a 36 000 lines csv file (with filter) : it take too long time. But seems it's OK with a ~800/1000 lines.
Currently : i have some issue with relevance and multiple question with this plugin.
If you have only one : you can add filter.NAOK in the relevance and in the filter : it work.
Survey menu / Resources
or Insert link in HTML editor
I test the system with a 36 000 lines csv file (with filter) : it take too long time. But seems it's OK with a ~800/1000 lines.
Currently : i have some issue with relevance and multiple question with this plugin.
If you have only one : you can add filter.NAOK in the relevance and in the filter : it work.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Attachments:
Last edit: 5 years 4 months ago by DenisChenu. Reason: Insert link in HTML editor
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago - 5 years 4 months ago #177059
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic autocomplete suggestions with csv file based on a previous question on same page
Thank you a lot. Now I've got it
The plugin displays the typed letters, which are in the suggested word, in bold. This is a nice feature.
Is it possible to add an instruction text to this question? Normally there is such a text beneath the question. See picture.
The plugin displays the typed letters, which are in the suggested word, in bold. This is a nice feature.
Is it possible to add an instruction text to this question? Normally there is such a text beneath the question. See picture.
Cheers kompetenzz
Attachments:
Last edit: 5 years 4 months ago by KompetenzZ.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 4 months ago #177082
by DenisChenu
Can you put a feature request on gitlab.com/SondagesPro/QuestionSettingsType/autoComplete/issues
gitlab.com/SondagesPro/QuestionSettingsT...utoComplete/issues/2 have the priority (this allow autoComplete with really big data), but an autohelp seem a good idea.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic autocomplete suggestions with csv file based on a previous question on same page
Good idea,KompetenzZ wrote: Is it possible to add an instruction text to this question? Normally there is such a text beneath the question. See picture.
Can you put a feature request on gitlab.com/SondagesPro/QuestionSettingsType/autoComplete/issues
gitlab.com/SondagesPro/QuestionSettingsT...utoComplete/issues/2 have the priority (this allow autoComplete with really big data), but an autohelp seem a good idea.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago #177091
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic autocomplete suggestions with csv file based on a previous question on same page
thank you, I did it.
Cheers kompetenzz
The topic has been locked.