Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Country list and dropdown autocomplete

  • limesurveyfu1
  • limesurveyfu1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 weeks ago - 5 years 2 weeks ago #181715 by limesurveyfu1
Country list and dropdown autocomplete was created by limesurveyfu1
Hey all,

on my search for a prebuilt "where are you from" country question solution,
I ended up planing to use the country list from surveymonkey and pasting them as answers for a dropdown question.

With the list being quite long I was expecting to find an option in the settings for the dropdown,
which enables autocompletion for the possible dropdown answer options. Sadly I only found
solutions using csv. I simply want to use the answers I already inserted.

Limesurvey has this internally e.g. for lang selection:



1. How I can make a drowdown question searchable/autocomplete (see above)?
2. Is "where are you from" not universal enough to offer this prebuilt?

Version 3.15.9+190214

Thank you very much an greetings from Berlin
FU
Last edit: 5 years 2 weeks ago by limesurveyfu1.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago - 5 years 2 weeks ago #181744 by Joffm
Replied by Joffm on topic Country list and dropdown autocomplete
Hi,
if you do not like the csv, just use an array.
The about 200 countries aren't to many.
And IMO you can exclude some.

Just enter
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#question{QID} input[type="text"]').autocomplete({
minLength: 2,
source: ["Test1","Test2","Test3"]
});
});
</script>

into your question code of a question type "short text".



Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 2 weeks ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • limesurveyfu1
  • limesurveyfu1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 week ago - 5 years 1 week ago #181788 by limesurveyfu1
Replied by limesurveyfu1 on topic Country list and dropdown autocomplete
Thank you very much for your quick response.

I don't want to use a "short text", a dropdown perfectly limits the range of possible answers.
I don't like a csv, nor an array, because the possible answers do already exist in the dropdown.
Why you I specify them again?
Last edit: 5 years 1 week ago by limesurveyfu1.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 week ago - 5 years 1 week ago #181793 by Joffm
Replied by Joffm on topic Country list and dropdown autocomplete

Why you I specify them again?

Because there is a solution.

And you seem to have an original list. (if not you can download from several websites)
If you do not, but in the drop-down. Then export the survey as "*.txt" and open in EXCEL or OpenOffice. Here you find your drop-down entries.
And to transform this to an array is done in 5 minutes with a small macro.

Or you take this:
["Afghanistan", "Ägypten", "Albanien", "Algerien", "Andorra", "Angola", "Antigua und Barbuda", "Äquatorialguinea", "Argentinien", "Armenien", "Aserbaidschan", "Äthiopien", "Australien", "Bahamas", "Bahrain", "Bangladesch", "Barbados", "Belgien", "Belize", "Benin", "Bergkarabach", "Bhutan", "Bolivien", "Bosnien und Herzegowina", "Botswana", "Brasilien", "Brunei", "Bulgarien", "Burkina Faso", "Burundi", "Chile", "Volksrepublik China", "Cookinseln", "Costa Rica", "Dänemark", "Deutschland", "Dominica", "Dominikanische Republik", "Dschibuti", "Ecuador", "El Salvador", "Elfenbeinküste", "Eritrea", "Estland", "Fidschi", "Finnland", "Frankreich", "Gabun", "Gambia", "Georgien", "Ghana", "Grenada", "Griechenland", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Indien", "Indonesien", "Irak", "Iran", "Irland", "Island", "Israel", "Italien", "Jamaika", "Japan", "Jemen", "Jordanien", "Kambodscha", "Kamerun", "Kanada", "Kap Verde", "Kasachstan", "Katar", "Kenia", "Kirgisistan", "Kiribati", "Kolumbien", "Komoren", "Kongo, Demokratische Republik", "Kongo, Republik", "Korea, Nord", "Korea, Süd", "Kosovo", "Kuba", "Kuwait", "Laos", "Lesotho", "Lettland", "Libanon", "Liberia", "Libyen", "Liechtenstein", "Luxemburg", "Madagaskar", "Malawi", "Malaysia", "Malediven", "Mali", "Malta", "Marokko", "Marshallinseln", "Mauretanien", "Mauritius", "Mazedonien", "Mexiko", "Mikronesien", "Moldawien", "Monaco", "Mongolei", "Montenegro", "Mosambik", "Myanmar", "Namibia", "Nauru", "Nepal", "Neuseeland", "Nicaragua", "Königreich der Niederlande", "Niger", "Nigeria", "Niue", "Nordzypern", "Norwegen", "Oman", "Österreich", "Osttimor / Timor-Leste", "Pakistan", "Palästina", "Palau", "Panama", "Papua-Neuguinea", "Paraguay", "Peru", "Philippinen", "Polen", "Portugal", "Ruanda", "Rumänien", "Russland", "Salomonen", "Sambia", "Samoa", "San Marino", "São Tomé und Príncipe", "Saudi-Arabien", "Schweden", "Schweiz", "Senegal", "Serbien", "Seychellen", "Sierra Leone", "Simbabwe", "Singapur", "Slowakei", "Somalia", "Somaliland", "Spanien", "Sri Lanka", "St. Kitts und Nevis", "St. Lucia", "St. Vincent und die Grenadinen", "Südafrika", "Sudan", "Südossetien", "Südsudan", "Suriname", "Swasiland", "Syrien", "Tadschikistan", "Taiwan", "Tansania", "Thailand", "Togo", "Tonga", "Transnistrien", "Trinidad und Tobago", "Tschad", "Tschechien", "Tunesien", "Türkei", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "Ungarn", "Uruguay", "Usbekistan", "Vanuatu", "Vatikanstadt", "Venezuela", "Vereinigte Arabische Emirate", "Vereinigte Staaten", "Vereinigtes Königreich", "Vietnam", "Weißrussland", "Westsahara", "Zentralafrikanische Republik", "Zypern"]

Und es ist flexibel



Regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 1 week ago by Joffm.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 week ago #181797 by DenisChenu
Replied by DenisChenu on topic Country list and dropdown autocomplete
You can test : gitlab.com/SondagesPro/coreAndTools/select2package

It replace dropdown in survey by select2.org/ if there are more than 15 choice
. Not really tested with 3.X

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.
More
4 years 5 months ago #189421 by BusyBonsai
Replied by BusyBonsai on topic Country list and dropdown autocomplete
Dear DenisChenu

We are trying to evaluate whether we want to install the select2 plugin on our institutions limesurvey installation. Since we are running dozens of surveys from diefferent projects at the same time, we'd need to know in advance: is it possible to limit this plugin to certain surveys? Or will it automatically affect all of them?

I / we didn't manage to find this information in either the select2 or limesurvey forum, hence I would be very grateful if you could clarify!

Best
Adam
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #189455 by DenisChenu
Replied by DenisChenu on topic Country list and dropdown autocomplete
Not currently, can be done.
extensions.sondages.pro/about/contact.html

I think it can be a settings by question too

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.
More
3 years 11 months ago #195967 by ymca
Replied by ymca on topic Country list and dropdown autocomplete

Joffm wrote:

Why you I specify them again?

Because there is a solution.

And you seem to have an original list. (if not you can download from several websites)
If you do not, but in the drop-down. Then export the survey as "*.txt" and open in EXCEL or OpenOffice. Here you find your drop-down entries.
And to transform this to an array is done in 5 minutes with a small macro.

Or you take this:
["Afghanistan", ...

Und es ist flexibel



Regards
Joffm

Is this file OK?
www.limesurvey.org/downloads/file/175-li...3166-1-alpha-2-codes
Because when I use it, Instead of:
SQ00;Afghanistan
SQ01;Saudi Arabia
...
it will save them as:
AF;Afghanistan
SA;Saudi Arabia
...
Does it matter?

LS Version 4.2+
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #195968 by Joffm
Replied by Joffm on topic Country list and dropdown autocomplete
This thread is about whether to use the select2package or the autocomplete option.

What are you going to use?

And

SQ00;Afghanistan
SQ01;Saudi Arabia
...
it will save them as:
AF;Afghanistan
SA;Saudi Arabia
...
Does it matter?

shows that you never read this
manual.limesurvey.org/Adding_answers_or_subquestions
especially paragraph 2.Code

And if you are going to use this list, you obviously want to use the ISO-3166 Codes.
en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
3 years 11 months ago #195969 by ymca
Replied by ymca on topic Country list and dropdown autocomplete

Joffm wrote: shows that you never read this
manual.limesurvey.org/Adding_answers_or_subquestions
especially paragraph 2.Code

Yes I did, probably missed it because was stuck with SQ, AO laws...

Joffm wrote: And if you are going to use this list, you obviously want to use the ISO-3166 Codes.
en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

So from that I guess this file is good?
www.limesurvey.org/downloads/file/175-li...3166-1-alpha-2-codes
Because I didn't find any file in the wiki site.

Also this file was not ordered by the countries names so a friend helped me sort them with Excel.
But I cannot save them as "Label sets" so thought it was because of something I did (I guess it's a bug).

LS Version 4.2+
The topic has been locked.
More
3 years 11 months ago #197213 by Vinicos
Replied by Vinicos on topic Country list and dropdown autocomplete
Dear Joffm,

Do you have a script like this with countries' names in other languages?
Besides that, can I use this syntaxes in version 3.17.7+190627?

Thanks
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #197215 by Joffm
Replied by Joffm on topic Country list and dropdown autocomplete

in other languages

Which ones?

Just use a search engine. Wikipedia of the desired languge will show something.
Then you have to copy this into the file.
Or you translate the names by yourself.

Second question:
Which syntax?

Did you try?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose