Welcome to the LimeSurvey Community Forum

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

How to add subanswers / nested answers in accordion style

  • david89
  • david89's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago - 6 years 9 months ago #155821 by david89
Hi, I'm quite new to LimeSurvey, but it seems to be the right choice.
The only thing I can't get to work is adding sub-answers to some answer options.

In one particular case I'm using the question type "List (Radio)" with 4 possible answers:
A, B, C and D

What I want to achieve now:
If someone selects A as answer, there should be 3 other sub-answers as choice.
To make it more visual:

- A
-- A1
-- A2
-- A3
- B
- C
- D

Best case scenario would be, that A1-A3 only shows, after A is beeing selected.
In fact, A by itself has no value, only the child-elements do.
So if one picks A, selecting a child of A is mandatory.

Don't know how to achieve that, couldn't find anything...


I'm using LS Version 2.65.4+170612 right now.

Thanks a lot!
Last edit: 6 years 9 months ago by david89.
The topic has been locked.
More
6 years 9 months ago #155824 by Ben_V
Hi David,

it's impossible by design if you consider that a radio question type can only receive a unique answer... so you should use at least a multiple choice questions (checkboxes)... + some javascript code to show/hide some answer options.

Probably a better design is to use several (conditionally shown) radio button questions + some css trick to simulate a unique question

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • markusfluer
  • markusfluer's Avatar
  • Visitor
  • Visitor
6 years 9 months ago - 6 years 9 months ago #155825 by markusfluer
Hello David,

I think this is only possible with a workaround.
You may hide subquestions via relevance and a.e. script them a little different behaviour.
The "sub-"subquestions may use some html code, so you can style them different to the subquestions, while they'll be virtually no difference for the backend.
The mandatory subchoice though is a little tricky.
As Ben_V already said LS currently has no possible way of achieving this, but in LS3 it will be possible to create such a question type.

I've appended a sample survey you may import you could achieve a similar behaviour with an array question type and only expression manager and html.

File Attachment:

File Name: subsubquestions.lss
File Size:24 KB
Last edit: 6 years 9 months ago by markusfluer.
The topic has been locked.
More
6 years 9 months ago #155827 by Ben_V
Hi Markus, I think an issue with your approach is the possibility to uncheck a choice... Needs some reset button, right?

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • david89
  • david89's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #155828 by david89
Thank you for the example provided...but it's not working as expected...there is no return possible (uncheck).
In addition the other answers disappear...I think this won't provide a good user experience.

Maybe I was searching the wrong way...maybe it can be achieved by simple JS/CSS.
So instead of having a conditional logic like I mentioned before,
maybe it's simpler to do it like this (all on same level):

- A
- A1 (hidden)
- A2 (hidden)
- A3 (hidden)
- B
- C
- D

If someone chooses A, I need to use a trigger and set A1-A3 on show(), toggle(), display:block, whatever...

Any ideas about this approach...?
The topic has been locked.
  • david89
  • david89's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #155829 by david89
Thanks! But if I use checkboxes I need to do a lot more workaround, right?
Because I want only 1 answer, not multiple.

Still fishing in the dark here...
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #155830 by holch
I think you will need to create your own workaround if you really want to do this exactly as described. There is no such functionality and any workaround idea that comes to mind has some kind of flaw.

I would probably go with the second question. OK, it means an additional question, but it is fairly simple and straight forward and you can create it out of the box.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • markusfluer
  • markusfluer's Avatar
  • Visitor
  • Visitor
6 years 9 months ago #155849 by markusfluer
My solution was just a proof of concept to point you in the right direction.
you may remove the relevance settings for A,B,C and D.
Also the reset button should not be that hard, or maybe add a second column with "N" No as the value.
That way you would be able to choose.
Also you could use checkboxes and limit the maximum answers to two.
That way one could only check two answers.

If all this is not what you where looking for, I suppose holch's answer is the best so far.
Just create the subquestions a s separate questions, only visible if you chose something from the main question.
The topic has been locked.
More
3 years 10 months ago - 3 years 10 months ago #198998 by ymca
Hi,

I was also looking for a solution.
Is this the solution in the new version?

Because I was looking for a way of doing a sub-answer and saw this by accident.
bugs.limesurvey.org/file_download.php?file_id=13178&type=bug

But I don't know where the option/button so I'll be able to see the "+" sign at the right side of the answer.
From this place I found the link (1072) that led me to the page with the option to add a sub-answer.
bugs.limesurvey.org/file_download.php?file_id=13177&type=bug

Also saw this code but don't know how it got there to one of the answers.
bugs.limesurvey.org/file_download.php?file_id=13179&type=bug

Is there a way I can find the place with the "+" sign or is it a bug or a missing link?

LS 4.2.1

LS Version 4.2+
Last edit: 3 years 10 months ago by ymca.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose