Welcome to the LimeSurvey Community Forum

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

titles between subquestions of the same array

  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
13 years 2 months ago #56607 by Mazi
What's your solution now?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 4 months ago #70343 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
Can you please let me know where to add this so that I can use this in my survey URGENTLY. Thanks
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
12 years 4 months ago #70345 by Mazi

adie wrote: Another trick is may be you can just hide all the radio button for the subtitle in the IMAGE 3 above ;-)

Code:
#answer12345X3X12C121-1{
display: none;
}

This is a valid approach, you only need to adjust the IDs and add answers as separators.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 4 months ago #70367 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
I would like to know where this code needs to be inserted.... if i need to add this in the template, then would like to know as exactly in which file? Or should I add this in the Array,using edit in HTML.. Please revert
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 4 months ago #70371 by DenisChenu
Replied by DenisChenu on topic titles between subquestions of the same array
In the template.css file of the template :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
12 years 4 months ago #70373 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
Can you let me know what will the whole code be like. Since I would want one line without radio button.. next few lines will should have radio button.. again in between a sub-heading and so on. If you could share with me the full code for this, would appreciate.

Am using the latest limesurvey... Am using Array option
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 4 months ago - 12 years 4 months ago #70374 by tpartner
Replied by tpartner on topic titles between subquestions of the same array
Rather than hide radios of sub-questions, I would use JavaScript to insert new rows with the sub-titles.

The following example workaround will insert new rows at positions 1, 3 and 6 as in the image below.

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the array. Replace "QQ" with the array question ID and adjust the row numbers and subtitles as necessary.
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function() {
 
    // Call the function to insert sub-titles
    // Parameters (Question ID, Row number, Sub-title)
    insertSubTitle(QQ, 1, 'Group 1');
    insertSubTitle(QQ, 3, 'Group 2');
    insertSubTitle(QQ, 6, 'Group 3');
 
    // A function to insert sub-title rows in an array
    function insertSubTitle(qID, row, subtitle) {
 
      // Add some row-specific classes
      $('#question'+qID+' table.question tbody[id^="javatbd"]').each(function(i, el){
        $(el).addClass('ansRow-'+(i+1));
      });
 
      // Find number of columns
      var cols = $('#question'+qID+' table.question tbody[id^="javatbd"]:first tr:first > *').length;
 
      // Define the row to be inserted
      var insertedRow = '<tbody> \
                  <tr class="insertedRow"> \
                    <td colspan="'+cols+'">'+subtitle+'</td> \
                  </tr> \
                </tbody>';
 
      // And insert the row
      $(insertedRow).insertBefore('#question'+qID+' .ansRow-'+row+'');
 
      // Fix up the row background colours
      var rowIndex = 0;
      $('#question'+qID+' table.question tr').each(function(i, el){
        rowIndex ++;
        if($(el).hasClass('insertedRow')) {
          rowIndex = 0;
        }
 
        $(el).removeClass('array1, array2');
 
        if(rowIndex % 2 == 0) {
          $(el).addClass('array1');
        }
        else {
          $(el).addClass('array2');
        }
      });
    }
 
  });
 
</script>

3) Add the following rules to the end of your template.css file:
Code:
.insertedRow {
  background-color: #66CCCC;
  font-weight: bold;
}
 
.insertedRow td {
  text-align: left !important;
}


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 12 years 4 months ago by tpartner.
The topic has been locked.
More
12 years 4 months ago #70380 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
Hi: Have included the javascript while creating the array question. i.e., have inserted after the text what needs to get displayed in the source... Also the other code in the template.css file... but am attaching as to how it looks after have done all these changes...

Am using 1.91+ version

Regards
Renu
Attachments:
The topic has been locked.
More
12 years 4 months ago #70382 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
have replaced QQ with the QuestionID... even then its the same ... :( :(
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 4 months ago #70383 by DenisChenu
Replied by DenisChenu on topic titles between subquestions of the same array

tpartner wrote: 1) Set up your survey to use JavaScript .

Look at this part:

Go to Global settings --> Security and set "Filter HTML for XSS" to "Off".


:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
12 years 4 months ago #70384 by renu81072
Replied by renu81072 on topic titles between subquestions of the same array
Hi.. Now the code does not get displayed.. Thanks.. But still as seen in your image of array1 question, the grouping is not happening.. :(

Have added this code in the template.css
.insertedRow { background-color: #66CCCC; font-weight: bold;} .insertedRow td { text-align: left !important;}

The other code in source... but still the grouping is not happening.. :(
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 4 months ago #70385 by tpartner
Replied by tpartner on topic titles between subquestions of the same array
Can you activate a sample survey for me to see?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose