Welcome to the LimeSurvey Community Forum

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

add an example/explanation column in array

  • bellagambad
  • bellagambad's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 4 weeks ago #265147 by bellagambad
add an example/explanation column in array was created by bellagambad
Your LimeSurvey version: 5.4.3+220926
Own server or LimeSurvey hosting: own server
Survey theme/template: custom fruity
==================
Hello LS,
I need to implement a standardized questionnaire (sample attached). Most questions are array, but with a second "sub-question" column that includes examples / explanations. I still haven't found a way to add that second column in the right place. The closest I got is by using the pipe symbol but with semantic differential the second column is added on the right. Is there a workaround that I am missing ? 
Thanks you in advance for the help,
David

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 4 weeks ago #265148 by Joffm
Replied by Joffm on topic add an example/explanation column in array
Hi,
why a separate column?
Put it into the first, with different colour, font-size,  etc.
​​​
O​​r use a tooltip / popover 

Joffm 

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

Please Log in to join the conversation.

  • bellagambad
  • bellagambad's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 4 weeks ago #265151 by bellagambad
Replied by bellagambad on topic add an example/explanation column in array
Hello Joffm,
Thanks for your reply. Yep, I thought about these solutions. Putting everything in the first is not the best idea in my opinion. It's better to have access to the information needed to answer the question without any superfluous elements. Adding examples and explanations directly to the sub-question is likely to create “noise” and make things more difficult for the participants, who may be able to answer without reading the examples and explanations. Tooltips seem preferable, but the questionnaire contains around 40 questions, which would be a lot of tooltips to consult. A separate column would simplify navigation in the context of this questionnaire, in my opinion.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 4 weeks ago #265157 by tpartner
Replied by tpartner on topic add an example/explanation column in array
You can move the semantic diff column via JavaScript. Can you attach a small sample survey (.lss file) containing only one question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • bellagambad
  • bellagambad's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 4 weeks ago #265160 by bellagambad
Replied by bellagambad on topic add an example/explanation column in array
Thank you Tony. Please find it attached.
And is it possible to add a header to this colum (i.e. on the same row as the answer options) ?
Thank you in advance, have a nice day,
David

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 4 weeks ago #265163 by Joffm
Replied by Joffm on topic add an example/explanation column in array

who may be able to answer without reading the examples and explanations

Exactly this is a big argument for tooltips.

It may either appear when the respondent hovers the text
 
or with a additional click (less noise - in your words)
 
See
[url] getbootstrap.com/docs/5.3/components/tooltips/ [/url]
for examples

It's better to have access to the information needed to answer the question without any superfluous elements.

I see no big difference between your "two-column" idea and this (it's a table with one row and two columns)
 
To add the header you may use
Replac e "inserted text" with the code of the table. 
Code:
<script type="text/javascript" charset="utf-8"> 
$(document).on('ready pjax:scriptcomplete',function(){
 
// Identify this question
var thisQuestion = $('#question{QID}');
 
// Insert header text
var insertedText = "Inserted text";
$('table.subquestion-list thead tr:last td:first', thisQuestion).addClass('inserted-header').append(insertedText);
});
</script>
 
<style>
td.inserted-[url=https://www.php.net/header]header[/url] {
font-weight: bold;
text-align: center;
vertical-align: middle !important;
}
</style>


And of course the very simple solution (only some css in the subquestion text)
 

Joffm

 

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 4 weeks ago - 6 months 4 weeks ago #265165 by Joffm
Replied by Joffm on topic add an example/explanation column in array
And after searching the forum ( I did your job) I found these two scripts
1. To move the right part of a semantic differential to another column
[url] forums.limesurvey.org/forum/can-i-do-thi...-radio-button#198883 [/url]
Just adapt "nth-last-child(2)" to your needs

2. To insert the additional headers
Add an inserted text to the last column as well (remember "the last one is moved, but it is still the last")

3. You may use the script to adapt the column width
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
    // Add a question class
    thisQuestion.addClass('custom-array');
 
    // Column-specific classes
    $('table.subquestion-list tr', thisQuestion).each(function(i) {
        $('th, td', this).each(function(i) {
            $(this).addClass('column-'+i);
        });
    });
});
</script><style type="text/css">
.custom-array table.subquestion-list col {
    width: auto !important;
}
.custom-array table.subquestion-list thead .column-0 { width: 22%; }
.custom-array table.subquestion-list thead .column-1 { width: 30%; }
.custom-array table.subquestion-list thead .column-2 { width: 12%; }
.custom-array table.subquestion-list thead .column-3 { width: 12%; }
.custom-array table.subquestion-list thead .column-4 { width: 12%; }
.custom-array table.subquestion-list thead .column-5 { width: 12%; }
</style>


Result
 


Now I noticed that you provided a lss Export.

Here is my result (inserting the above mentioned scripts)
 

File Attachment:

File Name: limesurvey...78_J.lss
File Size:38 KB


 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 months 4 weeks ago by Joffm.
The following user(s) said Thank You: bellagambad

Please Log in to join the conversation.

  • bellagambad
  • bellagambad's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 4 weeks ago - 6 months 4 weeks ago #265168 by bellagambad
Replied by bellagambad on topic add an example/explanation column in array
Thank you for your detailed answer Joffm
I've been using tooltips for a while now, but I prefer using them sparingly, as it requires an action from the participants. On the contrary, adding a column requires no action and participants can speed read the examples / explanations only if they want to, instead of having to hover over the "?" icon or anything else. And you don't know what you're missing if you don't consult the tooltip until you do. So it kind of forces participants to use them even if it's not necessary.

So I used your code and managed to have "during the last 30 working (...)" above the answer options. I'll try to move the last column and add a header with your clues.
And I'm glad you found an existing post. I guess I used the wrong keywords !

EDIT : just saw that you uploaded a .lss file. Thanks for that, I am going to have a look now.

Thanks,
David
Last edit: 6 months 4 weeks ago by bellagambad. Reason: just noticed the attached file from joffm

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose