Welcome to the LimeSurvey Community Forum

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

Autocomplete not working

More
6 years 4 months ago - 6 years 4 months ago #160764 by mcole
Autocomplete not working was created by mcole
I have a survey that I use twice a year. One survey I used autocomplete and it worked perfectly. I just added the simple script in the source area.

In the second survey I have almost 10,000 names in the autocomplete and it's too big for the source area.

So, I added the list to the /template.js file.
Code:
var doAutocomplete = function() {
    var qID = 8;
    $('#question'+qID+' input[type="text"]').autocomplete({
  minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated
  source: dentistNames
    });
 };
 
var dentistNames = [
"My","giant","list","of","names"
];

and in the source area of the question I added
Code:
Choose your Top Dentists - Select up to three (3) per specialty
<script type="text/javascript" charset="utf-8">
 $(document).ready(function(){doAutocomplete()});
</script>

And for some reason I cannot get it to work.

Can anyone see what I might have missed? Here is a link to an exact replica of the question:

phoenixmag.limequery.com/371455?newtest=Y&lang=en

Thank you for looking.

-Matt
Last edit: 6 years 4 months ago by mcole.
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 4 months ago #160769 by ollehar
Replied by ollehar on topic Autocomplete not working
Click F12 and check the JS console. There's a syntax error:

$(document).ready(function());

No function body.
The following user(s) said Thank You: mcole
The topic has been locked.
More
6 years 4 months ago #160787 by mcole
Replied by mcole on topic Autocomplete not working
Thank you. That did it. A couple of returns and I'm ready to rock!

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
doAutocomplete()
});
</script>

I sure appreciate it!!!!!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose