Welcome to the LimeSurvey Community Forum

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

Autocomplete multiple short text

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
1 year 4 months ago #246073 by brais24
Autocomplete multiple short text was created by brais24
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.35
Own server or LimeSurvey hosting: Own
Survey theme/template: Vanilla
==================
Hi, I update my LS from version 3 to version 5.6.35 and i have to adapt an old survey.

That survey have a multiple short text quetion with an autocomplete script that make appear an autocomplete options as you write.

On this new version that script seems to not work, so i try to look for other to implement on this version of LS.

I tried the option you can see on my attached file, an option wich i found on the forum, but i cant make it work.

 

File Attachment:

File Name: limesurvey...3813.lss
File Size:30 KB


I want to make an script wit a list of values that appear as you write.

Can you help me to adapt the script please? Or tell me how to do this.

Thank you.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 4 months ago - 1 year 4 months ago #246075 by Joffm
Replied by Joffm on topic Autocomplete multiple short text
Hi, I do not see a severe issue with your script.
Except:
a. The variable {QID} is a LimeSurvey system variable that always contains the actual questionID.
Therefore you should not change it.

b. Did you copy the script from a pdf or so?
You should not do this. There is always the chance that it contains some (hidden) HTML garbage.

c. You did not address the subquestions

Well, here the working script
Code:
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" /><script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID} input[type="text"]:eq(0)').autocomplete({
      minLength: 1,
      source: ["Adalbert Ameise", "Berta Biber", "Carlo Chinchilla", "Doris Dachs", "Emil Eidechse", "Florian Flamingo", "Gabriele Gnu", "Horst Habicht"]
    });
    $('#question{QID} input[type="text"]:eq(1)').autocomplete({
      minLength: 1,
      source: ["Adalbert Ameise", "Berta Biber", "Carlo Chinchilla", "Doris Dachs", "Emil Eidechse", "Florian Flamingo", "Gabriele Gnu", "Horst Habicht"]
    });
    $('#question{QID} input[type="text"]:eq(2)').autocomplete({
      minLength: 1,
      source: ["Adalbert Ameise", "Berta Biber", "Carlo Chinchilla", "Doris Dachs", "Emil Eidechse", "Florian Flamingo", "Gabriele Gnu", "Horst Habicht"]
    });
  });
</script>


You see the "eq(x)"? Here you address the subquestion, starting with 0.





By the way: Which script did you use before? The one that on your opinion doesn't work in version 5.x.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 4 months ago by Joffm.

Please Log in to join the conversation.

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
1 year 4 months ago #246082 by brais24
Replied by brais24 on topic Autocomplete multiple short text
Ok, it works without changing the ID, i suposse is a new feature since Limesurvey 2.72, on that version you have to indicate the question ID manually.

Thanks for the help.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 4 months ago #246084 by Joffm
Replied by Joffm on topic Autocomplete multiple short text
Hi,
this script works without any changes (only copy/paste from the post before) in 2.73

Here shown with the "ubuntu orange" template.





And also in 2.06. without any changes
 



Only in versions before, like 1.92 you have to enter the questionID manually (Expression Manager was not implemented)

Only for information

Joffm

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

Please Log in to join the conversation.

More
7 months 3 weeks ago - 7 months 3 weeks ago #263432 by Oterito
Replied by Oterito on topic Autocomplete multiple short text
Hi Joffm, i am trying to use this code in version 6.5.6 but is not working. Can you help me?
Last edit: 7 months 3 weeks ago by Oterito. Reason: Attachment

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose