Welcome to the LimeSurvey Community Forum

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

Controlling sub arrays in array selection

  • rehanfarrukh
  • rehanfarrukh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #229073 by rehanfarrukh
Controlling sub arrays in array selection was created by rehanfarrukh
Please help us help you and fill where relevant:
Your LimeSurvey version: color=#35363f]5.3.12+220502[/color
Own server or LimeSurvey hosting: Own servier
Survey theme/template: Company theme without Confuguraiton / advance tools
==================
I have added an array (5 points choice), and I am dividing the question further into three groups.
Like Q 4 shoudln't have any answer option, however, Q 4a, 4b and 4c should have answer options. Is there a way to control this? I have attached .lss file as well as screenshot of what I am trying to achive.
Thanks,
Rae 

File Attachment:

File Name: limesurvey...4973.lss
File Size:75 KB
   

File Attachment:

File Name: limesurvey...4973.lss
File Size:75 KB
 

File Attachment:

File Name: limesurvey...4973.lss
File Size:75 KB

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #229076 by Joffm
Replied by Joffm on topic Controlling sub arrays in array selection
Hi,
search the forum for keyword "subheading1".
You will find a lot of examples.

And here is yours. The subheading a bit bolded for show.
 
Add this to the source code of your question
Code:
<script type="text/javascript" charset="utf-8">        
    $(document).ready(function() { 
       // Identify this question
      var thisQuestion = $('#question{QID}');
      // Define the sub-heading text strings
      var subHeading1 = '<span style="color:maroon;font-size:12pt;font-weight:bold">I feel safe and well protected while working onsite due to the health and safety measures...</span>';
 
      var columnsLength = $('tr.answers-list:eq(0) > *', thisQuestion).length;
        // Insert the new rows
        $('tr.answers-list:eq(3)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+subHeading1+'</th></tr>');
        // Fix up the row classes
      var rowClass = 1;
      $('table.answers-list tbody tr', thisQuestion).each(function(i) {
            if($(this).hasClass('sub-header-row')) {
                rowClass = 1
            }
            else {
                rowClass++;
            $(this).removeClass('array1 array2')
            if(rowClass % 2 == 0) {
                $(this).addClass('array2');
            }
            else {
                $(this).addClass('array1');
                }
            }
        });
    });
</script>

Adapt to your wishes

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: rehanfarrukh

Please Log in to join the conversation.

  • rehanfarrukh
  • rehanfarrukh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #229080 by rehanfarrukh
Replied by rehanfarrukh on topic Controlling sub arrays in array selection
Thanks Joffm! Appreciate your help!

Please Log in to join the conversation.

  • rehanfarrukh
  • rehanfarrukh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #229083 by rehanfarrukh
Replied by rehanfarrukh on topic Controlling sub arrays in array selection
Just quick question, since the account I am using is company account, they haven't allowed us to access configuration menu. Is there any other way to add this code?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #229084 by Joffm
Replied by Joffm on topic Controlling sub arrays in array selection
Please, read everything

Add this to the source code of your question


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

Please Log in to join the conversation.

  • rehanfarrukh
  • rehanfarrukh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #229087 by rehanfarrukh
Replied by rehanfarrukh on topic Controlling sub arrays in array selection
I added this code to the question SQ004 but it is not working... Am I entering at the wrong place? If you don't mind sending me the screenshot of where you inserted tihs code, that would be super helpful. thanks so much
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #229088 by Joffm
Replied by Joffm on topic Controlling sub arrays in array selection
You added it to the subquestion.
Insert into the source code of the QUESTION
 

Please, read the manual to learn some basics,
Import and study the sample surveys that you find
in the demo installation
[url] demo.limesurvey.org/admin [/url]
in the manual
[url] manual.limesurvey.org/ExpressionScript_sample_surveys/en [/url]
 

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

Please Log in to join the conversation.

  • rehanfarrukh
  • rehanfarrukh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #229089 by rehanfarrukh
Replied by rehanfarrukh on topic Controlling sub arrays in array selection
I added into the actual question but it is working on my personal account but in the company's limesurvey account, which is weird. I asked my system admin to look into this as why i can't add it in. However, it is working on my own limesurvey account.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago - 1 year 11 months ago #229090 by Joffm
Replied by Joffm on topic Controlling sub arrays in array selection
This isn't weird.
Many times super admins do not allow admins to insert javascript for safety reasons.
Buzzword: XSS filter. Should be set to OFF

Joffm

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

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose