- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Country list and dropdown autocomplete
- ricardo
- Offline
- New Member
Less
More
3 years 5 months ago #207837
by ricardo
Replied by ricardo on topic Country list and dropdown autocomplete
@Joffm. Your example does not work in Version 3.19.1+191009
The "Test!2 example in the manual does work though.
<script type="text/javascript" charset="utf-8">
alert("Test!");
</script>
The "Test!2 example in the manual does work though.
<script type="text/javascript" charset="utf-8">
alert("Test!");
</script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 5 months ago #207838
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 Country list and dropdown autocomplete
Did you include jQuery UI as indicated earlier in this thread?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: JamieD
The topic has been locked.
- kevinleung
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
3 years 2 months ago #211200
by kevinleung
Replied by kevinleung on topic Country list and dropdown autocomplete
Hi tpartner,
Thank you for sharing the script.
May I know if "Array text" feasible to work on autocomplete function? (one of the column could autocomplete)
Kevin
Thank you for sharing the script.
May I know if "Array text" feasible to work on autocomplete function? (one of the column could autocomplete)
Kevin
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 2 months ago #211223
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 Country list and dropdown autocomplete
This should work in, for example, the second column of an array-texts type question:
Code:
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" /> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { var column = 2; $('#question{QID} .answer-item:nth-child('+(column+1)+') input[type="text"]').autocomplete({ minLength: 2, source: ["África do Sul", "Albânia", "Alemanha", "Andorra", "Angola", "Anguilla", "Antigua", "Arábia Saudita", "Argentina", "Armênia", "Aruba", "Austrália", "Áustria", "Azerbaijão", "Bahamas", "Bahrein", "Bangladesh", "Barbados", "Bélgica", "Benin", "Bermudas", "Botsuana", "Brasil", "Brunei", "Bulgária", "Burkina Fasso", "Butão", "Cabo Verde", "Camarões", "Camboja", "Canadá", "Cazaquistão", "Chade", "Chile", "China", "Vaticano", "Colômbia", "Congo", "Coreia do Norte", "Coreia do Sul", "Costa do Marfim", "Costa Rica", "Croácia", "Dinamarca", "Djibuti", "Dominica", "Estados Unidos da América", "Egito", "El Salvador", "Emirados Árabes", "Equador", "Eritreia", "Escócia", "Eslováquia", "Eslovênia", "Espanha", "Estônia", "Etiópia", "Fiji", "Filipinas", "Finlândia", "França", "Gabão", "Gâmbia", "Gana", "Geórgia", "Gibraltar", "Granada", "Grécia", "Guadalupe", "Guam", "Guatemala", "Guiana", "Guiana Francesa", "Guiné-Bissau", "Haiti", "Holanda", "Honduras", "Hong Kong", "Hungria", "Iêmen", "Ilhas Cayman", "Ilhas Cook", "Ilhas Curaçao", "Ilhas Marshall", "Ilhas Turks & Caicos", "Ilhas Virgens (brit.)", "Ilhas Virgens(amer.)", "Ilhas Wallis e Futuna", "Índia", "Indonésia", "Inglaterra", "Irlanda", "Islândia", "Israel", "Itália", "Jamaica", "Japão", "Jordânia", "Kuwait", "Letônia", "Líbano", "Liechtenstein", "Lituânia", "Luxemburgo", "Macau", "Macedônia", "Madagáscar", "Malásia", "Malaui", "Mali", "Malta", "Marrocos", "Martinica", "Mauritânia", "Mauritius", "México", "Moldova", "Mônaco", "Montserrat", "Nepal", "Nicarágua", "Níger", "Nigéria", "Noruega", "Nova Caledônia", "Nova Zelândia", "Omã", "Palau", "Panamá", "Papua-Nova Guiné", "Paquistão", "Peru", "Polinésia Francesa", "Polônia", "Porto Rico", "Portugal", "Qatar", "Quênia", "República Dominicana", "República Tcheca", "Reunion", "Romênia", "Ruanda", "Rússia", "Saipan", "Samoa Americana", "Senegal", "Serra Leone", "Seychelles", "Singapura", "Síria", "Sri Lanka", "St. Kitts & Nevis", "St. Lúcia", "St. Vincent", "Sudão", "Suécia", "Suíça", "Suriname", "Tailândia", "Taiwan", "Tanzânia", "Togo", "Trinidad & Tobago", "Tunísia", "Turquia", "Ucrânia", "Uganda", "Uruguai", "Venezuela", "Vietnam", "Zaire", "Zâmbia", "Zimbábue"] }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- kevinleung
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
3 years 2 months ago #211321
by kevinleung
Replied by kevinleung on topic Country list and dropdown autocomplete
Hi tpartner,
Thanks!
Could we show the list if the respondent just click on the text box?
I changed: "minLength: 0,", but it still need to input at least one character.
Kevin
Thanks!
Could we show the list if the respondent just click on the text box?
I changed: "minLength: 0,", but it still need to input at least one character.
Kevin
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 2 months ago - 3 years 2 months ago #211354
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 Country list and dropdown autocomplete
As far as I know, that's not possible with the jQuery Autocomplete plugin.
Maybe try something like the Select2 component - select2.org/ .
Inspiration - github.com/tpartner/LimeSurvey-Searchable-Dropdown
Maybe try something like the Select2 component - select2.org/ .
Inspiration - github.com/tpartner/LimeSurvey-Searchable-Dropdown
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 2 months ago by tpartner.
The topic has been locked.