Welcome to the LimeSurvey Community Forum

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

A text array with "drop-down" answer instead of text typing

  • IoannisKls
  • IoannisKls's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #239823 by IoannisKls
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================

Hello everyone,

I hope you are doing well.

I am a student trying to create a questionnaire to be used for my Master's internship. 

What I want to do is to create a text Array but with a drop-down question instead of texting for each box. The idea is that in the end I have a table with subquestions on the "X" and "Y" axes and for each corresponding block people will be able to answer by choosing one of the options on the drop-down list. The answers within the lists will be different for each column .

I saw similar posts asking the same question and the answers usually provided some java code. I am not familliar with Java and even if I tried I couldn't understand the code provided. Does anyone have any idea of how I can solve this? I am still familliar with coding since I know R but not java. Is there a general code with a description which I can use? Is this very advanced to implement?

I know I am maybe asking a lot. I even contacted the support team but the answer was not helpful unfortunately.

Thank you all in advance and have a great day!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 2 months ago #239824 by Joffm
As you wrote, there are many examples here.
And many working sample surveys.
Import one of them into your installation and study the source code of the question.
It is really straightforward.
The main and only part to adapt is this
Code:
// Insert selects
$('.answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">...</option>\
<option value="1">Fußball</option>\
<option value="2">Handball</option>\
<option value="3">Karate</option>\
<option value="4">Leichtathletik</option>\
<option value="5">Schwimmen</option>\
<option value="6">Volleyball</option>\
</select>');
$('.answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">...</option>\
<option value="1">U8 (2014 und jünger)</option>\
<option value="2">U10 (2012-2013)</option>\
<option value="3">U12 (2010-2011)</option>\
<option value="4">U14 (2008-2009)</option>\
<option value="5">U16 (2006-2007)</option>\
<option value="6">U18 (2004-2005)</option>\
</select>');
You see this?
$('.answer-item.answer_cell_X001
This means that the drop-down is inserted in the column with code X001.

There are other examples that do not depend on the column code, but on the column number.

But you neither answered the initial questions about your LimeSurvey version and the hosting nor did you provide a lss export with your survey (the part of this question you completed so far)

Joffm

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

Please Log in to join the conversation.

  • IoannisKls
  • IoannisKls's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #239833 by IoannisKls
Hello,

Thanks a lot for the clarification and help. I managed to implement it in my survey and make the table I planned to. I chose to go with column number.

For the record, my version is "Version 3.27.21+211021"

Kind Regards,
Ioannis

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose