Welcome to the LimeSurvey Community Forum

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

Multiple choice table - Discrete choice Models

More
6 years 10 months ago - 6 years 10 months ago #153244 by Rexha
Hello everyone,

I'm a PhD student and my University has LimeSurvey Plataform as tool to perform surveys. However, there is a specific type of questions that i need to insert in the survey, but the default options don't offer me it.

I need a table with six coluns and 23 lines all to be fill up with text, by me. Then a 24 line should have the radio button, that allows the respondent to select one of the 5 coluns (the first colun is just informative text).

The image in anex presents an example of what i need to do in LimeSurvey Plataforms, so my questions are, can this be done ? and how can i do this?



I thank you, in advance for all attention that might be spent in this subject.
Last edit: 6 years 10 months ago by Rexha.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153262 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
You will need to insert the HTML table into the question text and then use JavaScript to move the radio buttons into the inserted table. What version of LimeSurvey are you using?

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
6 years 10 months ago #153331 by Rexha
Thank you for the quick replay.

The LimeSurvey i am using is Version 2.06+ Build 151018.

I don't know programing at all, however i have tryed to follow your sugestion and did a HTML code as you mentioned, and pasted it in the predefined matrix answer field. The result is shown bellow, if i'm not mystaken this way each colun will be a variable in my database, just the way i need it. But, still idk how to apply java script to make the right side text be in the same level (aligned) with the other text... Can u give me further information?

Aside note, I will have to build 81 tables all containing differente text information, there isnt any other method more simple to do this?

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #153334 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
Well, that's not exactly how I would have done it but it works.

So, just to be clear, you want the "Tipo Combustivel..." up beside the "Veículo Básico..."?

Regarding the data, each column is an answer to the subquestion so this will result in one column in the data with 5 possible answers.

Sorry, there is no simpler way to do it.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.
More
6 years 10 months ago #153335 by jelo

Rexha wrote: Aside note, I will have to build 81 tables all containing differente text information, there isnt any other method more simple to do this?

LimeSurvey is not suitable for Choicetasks. Consider using a proper tool like Sawtooth Software.
That way you ensure that you don't have the same stimulus order for every respondent.
You be able to create eg. 300 different stimulus plans which will bring much more robust data. To create choice tasks on the same quality level in LimeSurvey cost you a lifetime, since you have to create every set manually. If this is for a PhD you might check the experimental design first.



The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
More
6 years 10 months ago #153337 by Rexha
Ty for the replays,

I would like the "Tipo Combustivel..." up beside to "Combustão" the "Veículo Básico" is the choice label.

Jelo, ty for the information about this other software i will for sure check it out. I aldredy designed the experiment with SPSS - applying factorial factor analysis, so i got 81cards wich i devided in 9 blocks, so i will do a survey with 9 different versions of it.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153346 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
Adding the following script to the question source will move the HTML of the sub-question up into the cell beside the answers.

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID} table.subquestions-list').addClass('custom-array-1');
    $('#question{QID} table.subquestions-list thead td:eq(0)').remove();
    $('#question{QID} table.subquestions-list thead tr:eq(0)').prepend('<th />');
    $('#question{QID} table.subquestions-list thead th:eq(0)').html($('#question{QID} th.answertext:eq(0)').html());
    $('#question{QID} th.answertext:eq(0)').html('');
  });
</script>

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
6 years 10 months ago #153359 by Rexha
Once more ty for the quick replay.

Srry for my nuub question, but I belive that to acess the question source, i would need to have admin powers of the plataform. I don't see were can i add the JavaScript code in the interface i have. Any hints :/ ?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153364 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
See here for info on how to use JavaScript - manual.limesurvey.org/Workarounds:_Manip....29_in_LimeSurvey.3F

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
6 years 10 months ago #153416 by Rexha
I apreciate for the quick replay.

So, i have been now inserting my data in the survey and because not all colums have the same number of lines .. this mean i would have to adjust the 81 cards i need to do by hand + HTML + JavaScrip adjust at all time, and the final result would be to much text gather together and looking desorganized which would lead to people not even read the info.

So my last question is can it be made with an Image and then be added the radio buttons to each colun of the image? (ofc that in terms of database i want it to be one variable with 5 possible awnsers).

Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153427 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
Yes, you can use images...

1) Place the appropriate image in the first (and only) sub-question text of the array. Do not place any other text there.

2) Add this slightly modified script in the source of the question text of the array. It will hide the existing header row of the array, insert a new header row and move the image up into that new row.
Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    var columnCount = $('#question{QID} table.subquestions-list thead tr:eq(0) > *').length;
    $('#question{QID} table.subquestions-list').addClass('custom-array-1');
    $('#question{QID} table.subquestions-list thead thead tr:eq(0)').hide();
    $('#question{QID} table.subquestions-list thead').append('<tr class="inserted-row"><td colspan='+columnCount+'></td></tr>');
    $('#question{QID} table.subquestions-list .inserted-row td:eq(0)').html($('#question{QID} th.answertext:eq(0)').html());
    $('#question{QID} th.answertext:eq(0)').html('');
  });
</script>

3) Place these style rules at the end of template.css. (these are for the default template so may need to be modified for others)
Code:
table.custom-array-1 {
  width: 100%;
  max-width: 1260px;
  border: 1px solid #333333;
}
 
table.custom-array-1 .inserted-row td {
  text-align: center;
  padding: 0;
}
 
table.custom-array-1 .inserted-row img {
  width: 100%;
}
 
table.custom-array-1 tr.array2:hover {
    background-color: #EEEEEE;
}
 
table.custom-array-1 td.answer-item:hover {
    background-color: #DDDDDD;
}

Here's a quick mock-up (you will, of course, need to tweak the image a bit).


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #153428 by tpartner
Replied by tpartner on topic Multiple choice table - Discrete choice Models
...one more tip - set the array "(Sub-)question width" to 16.67. This will give you 6 even-width columns.

Cheers,
Tony Partner

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

Lime-years ahead

Online-surveys for every purse and purpose