Welcome to the LimeSurvey Community Forum

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

Text array with autocomplete

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 3 months ago #232723 by brais24
Text array with autocomplete was created by brais24
Please help us help you and fill where relevant:
Your LimeSurvey version: 2.72
Own server or LimeSurvey hosting: Own
Survey theme/template: Default
==================
Hi there people, first, thanks for the help, what i need is to make an autocomplete when you write on a question, i be able to do it on a multiple short text, but i want to do the same on an array text question like this.

 

I have tried to do it putting this script in the question title, which works for me with several short texts question, can someone help me to make this work? Thank you very much.

The code that i use is this (i put just 2 examples of autocomplete on this code).

<script type="text/javascript" charset="utf-8">

    $(document).ready(function() {

        var q1ID = '23567';

        var states = "C Industria manufacturera/10 Industria de la alimentación/101 Procesado y conservación de carne y elaboración de productos cárnicos".split('/');

$('#question'+q1ID+' input.text').autocomplete({
            source: states
        });

    });

</script>

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #232725 by Joffm
Replied by Joffm on topic Text array with autocomplete
Hi,
I do not see an issue with this (here in 2.73.1)
Code:
<script type="text/javascript" charset="utf-8">
 
    $(document).ready(function() {
 
        $('#question{QID} input[type="text"]').autocomplete({
            minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated
            source: [
                "Adalbert Ameise",
                "Berta Biber",
                "Carlo Chinchilla",
                "Doris Dachs",
                "Emil Eidechse",
                "Florian Flamingo",
                "Gustav Gans"
            ]
        }); 
    });
</script>



Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 3 months ago #232729 by brais24
Replied by brais24 on topic Text array with autocomplete
Nice, it works!! Thank you!!!

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose