Welcome to the LimeSurvey Community Forum

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

Conjoint experiment/referencing past question responses

  • edewil
  • edewil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 weeks ago #254375 by edewil
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.49
Own server or LimeSurvey hosting:
Survey theme/template: Vanilla
==================
Hello everyone! I previously implemented a conjoint experiment in LimeSurvey (with a lot of help from this forum, thank you all) and I am trying to do it again for another project. I'm using a different version than last time (I'm on a different organization's account and previously used version 3.27.19) and the process that worked for me last time isn't working now. Here is a sample version of the survey I'm working on:  

File Attachment:

File Name: conjoint_t...1-11.lss
File Size:56 KB


I have 4 attributes with two possible values, so there are 16 profiles that can be shown. The intended final result is 5 questions which each present a comparison between 2 randomly selected profiles, with the attributes in random order.

Here is how I implemented it in the past/the process I am currently using:

In the first item (H0), I generate a random string of 10 numbers between 1 and 16 which determine the pairs that are presented. If the first 6 characters of the string are "005009", question 1 presents a comparison between profile 5 and profile 9.

The second item (H1) contains the profiles themselves as default answers (text changed so attribute 1 is a or b, 2 is c or d, 3 is e or f, 4 is g or h). The text for each attribute is 52 characters (208 per profile) including whitespace so I can later pull out profiles and attributes in order.

The third item (H2) generates a string that dictates the order in which the attributes are presented. E.g. if the string begins with "acdb", question 1 will present the profile with the characteristics ordered as follows: attribute 1, attribute 3, attribute 4, attribute 2.

In the questions themselves (just question 1 here), I reference the profile list generated in H0 and pull the appropriate substring from the profile text in the default answer of H1. I then reference the string generated by H2 and arrange the rows/attributes in the appropriate order.

I have unhidden H0, H1, and H2 for troubleshooting purposes. Here's a screenshot: 
 

These are the issues I've been having (that I didn't deal with in my last conjoint experiment):

1. My reference to H0 doesn't work unless I manually enter a character after the string that is generated. Once I do this, Question 1 shows the profiles it should be presenting based on the first 6 characters of H0. Otherwise, it just presents profile 1 twice.

2. My reference to the attribute order in H1 isn't working at all. The attributes are presented in the same order every time.

3. The code to move the radio buttons into my table is not working.

4. All of these observations are based on previewing the question group. When I try to preview the entire survey, the page just continually refreshes and tries to proceed to the next page. 

I have extremely limited knowledge of JavaScript (and HTML) so I apologize in advance if any of this is really obvious, I've been trying to figure it out on my end but no luck. I am also wondering if it has to do with using "{source}" rather than "Script" for my code in the questions; the last survey I made didn't have "Script" as an option and I haven't found anything explaining the difference.

I know this is a lot of questions, thank you so much in advance for any help!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #254376 by Joffm
Hi,
your conjoint array must be in a different group.
Obvious, because the script runs, when the document is ready.
So the question is alrady displayed.

And check the length of your texts.

All your attributes are calculated by the same formula
Code:
Attribute 1
{trim(substr(substr(H1, (substr(H0, 0, 3) - 1) * 209, 209),0,52))}
{trim(substr(substr(H1, (substr(H0, 3, 3) - 1) * 209, 209),0,52))}
 
Attribute 2
{trim(substr(substr(H1, (substr(H0, 0, 3) - 1) * 209, 209),0,52))}
{trim(substr(substr(H1, (substr(H0, 3, 3) - 1) * 209, 209),0,52))}
Should be
0, 3
3, 3
6, 3
9, 3
...

The code to move the radios should be
Code:
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
     // Move the radios
    $('.question-text table:eq(0) tr:last td:eq(1)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion));
    $('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion));
 
    // Some classes for presentation
    $('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio');
    $('.question-text table:eq(0) .radio-item label', thisQuestion).show();
 
    // Click event on the table cells
    $('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) {
      $('input:radio', this).trigger('click');
    });
    $('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) {
      e.stopPropagation();
    });
 
   // Clean-up styles
    $('.answer-container', thisQuestion).hide();
    $('.question-text table:eq(0) .label-text', thisQuestion).remove();
    $('.question-text table:eq(0) .radio-text', thisQuestion).css({
      'cursor': 'pointer'
 
    });
    
    $('td.radio', thisQuestion).css({
            'display': 'table-cell',
            'padding': '3px',
     
        });

the page just continually refreshes and tries to proceed to the next page.

In your scripts there is  "$('#ls-button-submit').trigger('click');"
Better you display a text display question here to explain something about the next questions and hide the scripts with css class "hidden"

Joffm

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

Please Log in to join the conversation.

  • edewil
  • edewil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 weeks ago #254440 by edewil
Thank you so much! I can't believe I didn't notice the hidden questions needed to be in a different group and your code to move the radios worked perfectly!

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose