Country list and dropdown autocomplete

More
2 months 6 days ago - 2 months 6 days ago #181715 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
Attachments:
Last edit: 2 months 6 days ago by limesurveyfu1.

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
2 months 6 days ago - 2 months 6 days ago #181744 by Joffm
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
Attachments:
Last edit: 2 months 6 days ago by Joffm.
The following user(s) said Thank You: DenisChenu

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago - 2 months 5 days ago #181788 by limesurveyfu1
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: 2 months 5 days ago by limesurveyfu1.

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago - 2 months 5 days ago #181793 by Joffm

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
Attachments:
Last edit: 2 months 5 days ago by Joffm.

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #181797 by DenisChenu
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 .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!