Welcome to the LimeSurvey Community Forum

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

More than two, dual scale array.

More
8 years 1 month ago #156519 by nique
Hi there,

I can see there are a few threads on this topic but for the life of me I cannot get the code working or I am not using it properly.


www.limesurvey.org/forum/can-i-do-this-w...n-boxes?limitstart=0

www.limesurvey.org/forum/can-i-do-this-w...rt-text?limitstart=0


What I want to be able to do is have an array with 7 sub-questions of the y axis, 3 time periods along the x axis, and then dropdown boxes in the 21 answer options.

There will be 6 answers in the dropdown menu (A lot below average - A lot better than average).

Replacing the number array with the dropdown menu would be great as I don't care for the text to be saved. I just need the participant to see the answer options, and I will analyse with the numbers anyway.

Any help is appreciated. Apologies if I am missing something obvious but the old code and multiple threads just got a bit confusing.
The topic has been locked.
More
8 years 1 month ago #156522 by nique
Cannot seem to edit my own post (doing great today) but just wanted to add that yes, I know this plugin exists and unfortunately I cannot access the template to add it in - www.limesurvey.org/forum/plugins/104019-...ith-dropdown-or-mask

So a javascript work around is preferred. Thanks.
The topic has been locked.
More
8 years 1 month ago #156578 by tpartner
LimeSurvey version?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 1 month ago #156579 by nique
Apologies. Version 2.59
The topic has been locked.
More
8 years 1 month ago #156580 by tpartner
Add a script something like this to the question source:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function(){  
 
    // Identify this question
    var qID = {QID};
    var thisQuestion = $('#question'+qID);
 
    var optionLabels = {
      1: 'Label 1',
      2: 'Label 2',
      3: 'Label 3',
      4: 'Label 4',
      5: 'Label 5',
      6: 'Label 6'
    }
 
    $.each(optionLabels, function(i, val) {
      $('select.form-control option[value="'+i+'"]', thisQuestion).text(val);
    });    
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...5886.lss
File Size:19.11 KB

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: nique
The topic has been locked.
More
8 years 1 month ago #156590 by nique
Works perfectly and significantly cleaner script than anything I was attempting. Thank you!
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose