Welcome to the LimeSurvey Community Forum

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

Autocomplete of array text fields

More
9 years 10 months ago #115357 by nagim
Autocomplete of array text fields was created by nagim
Hi,

I used the jQuery autocomplete function with success for free text and multiple short text questions (described here):

I tried to switch the question type for Array (Texts), but it's not working anymore on the array text fields.

Code is here:
Code:
<script type="text/javascript" charset="utf-8">
 
        $(document).ready(function() {
 
                var q1ID = '121580';
 
                var toollist = "tool1,tool2".split(',');
 
                $('#question'+q1ID+' input.text').autocomplete({
                        source: toollist,
            minLength: 0,
            scroll: true
                }).focus(function() {
                $(this).autocomplete("search", $(this).val());
            });
 
        });
 
</script>

Any suggestions how to modify the code to work on array text fields?

Thanks in advance!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 10 months ago #115383 by tpartner
Replied by tpartner on topic Autocomplete of array text fields
Hmm...there doesn't seem to be a "text" class applied to those input elements.

Try changing this:
Code:
$('#question'+q1ID+' input.text').autocomplete({

To this:
Code:
$('#question'+q1ID+' input[type="text"]').autocomplete({

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: nagim
The topic has been locked.
More
9 years 10 months ago #115385 by nagim
Replied by nagim on topic Autocomplete of array text fields
You're spot on!
It works fine with array (text) as well!

Thanks very much!
The topic has been locked.
More
9 years 4 months ago #122036 by sabrina_g
Replied by sabrina_g on topic Autocomplete of array text fields
Hi tpartner!
I'm trying to use this java to autocomplete an array text, but it doesn't work, i can't find out why. I've read a lot of previus posts but can't fixed it .
Can you help me with this please?
Thank you!!
I put the code below:

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

$(document).ready(function() {
// Identify the question
var q1ID = '{QID}';
var q1 = $('#question'+q1ID+' input[type="text"]').autocomplete({
//var url = 'https://localhost/limesurvey2/upload/templates/Apertura_BDO/nombres.csv';
var url = '{TEMPLATEURL}nombres.csv';
var countries = new Array();
});
});
});
</script>
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago - 9 years 4 months ago #122128 by tpartner
Replied by tpartner on topic Autocomplete of array text fields
I don't see that you have applied the autocomplete plugin. Please review the complete workaround:

- www.limesurvey.org/manual/Workarounds:_M...1_and_later_versions

- www.limesurvey.org/manual/Workarounds:_M...r_LimeSurvey_2.05.2B

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 4 months ago by tpartner.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose