Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Implementing conjoint analysis in LS

Implementing conjoint analysis in LS 2 years 7 months ago #106460

  • blacknail
  • blacknail's Avatar
  • Offline
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 1
Hi jelo, concerning your question, in fact as you probably know, Sawtooth Software's SSI Web is proprietary software, and I only have a license for the MaxDiff module. That's when LimeSurvey enters the equation. Since each item is predefined to belong to a certain profile, I'm only implementing CBC in LimeSurvey for presentation purposes.

Regarding the implementation itself, I made the following changes to the layout, resulting in the image attached (cbc.png):

1. In template.css, I added the following line to the table.question class, in order to collapse the question / answer table borders:
border-collapse: collapse;

2. Then, I've right-aligned the text in the left column (first one) and set also it's right-padding to 10 pixels. Now I'll just explain how are the table's TDs and THs organized, in order to fully understand the following lines (if someone spots some wrong guessing, please feel free to correct me). Since this is an array question, I'll always have to have at least one subquestion (this is the case, with just a plain header). I believe that for that particular reason, the header in the table's first column (subquestion) is at the bottom of it, in this case in the second row (please compare to the attachment), since the first column are the headers to the subquestions, pretty much like the first row has the headers for the questions:

So, to right-align the text and set it's padding in the (1,1) cell, just insert this into the #limesurvey table.question thead td ID:
text-align: right;
padding-right: 10px;

3. Finally, to change the first column's color, and alternate the remaining odd / even column color's, we'll have to insert some JavaScript in the source of the question:
<script >
$(document).ready(function ()
    //change first column's background color and set it's text
    $("table.question thead td").css("background-color", "#FCFCFC");
    $("table.question tbody th").css("background-color", "#FCFCFC");
    $("table.question thead td").html("<h2>Nome do produto</h2> <h2>Nível de poupança</h2> <h2>Preço</h2>");
    // change even column's colors
    $("table.question thead th:even").css("background-color", "LightGray");
    $("table.question tbody td:even").css("background-color", "LightGray");
    // change odd column's colors
    $("table.question thead th:odd").css("background-color", "#F1F1F1");
    $("table.question tbody td:odd").css("background-color", "#F1F1F1");

Finally, I just have one question, hope someone can help me. I've tried to achieve what I did in point 3 via CSS, I was close to it, but unfortunately after some hours and a little messy code, I gave up. I was hoping to do it because I think I should use JavaScript only when needed, and prefer CSS to it whenever possible. Do you agree, or do you think this doesn't make sense. Give me your thoughts, please.

Last Edit: 2 years 7 months ago by blacknail. Reason: attachment missing
The administrator has disabled public write access.
The following user(s) said Thank You: Jon
Time to create page: 0.221 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form