Welcome to the LimeSurvey Community Forum

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

Dropdown answers based on previous answers

  • energiejeunes
  • energiejeunes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago - 7 years 10 months ago #137244 by energiejeunes
Dropdown answers based on previous answers was created by energiejeunes
Hi everybody,

I'm very sorry for reposting, I know this topic has been already discussed (e.g here or here ) but I've spent about 5hours trying to do the following and already tried every proposed solutions. So here's what I want to do :

3 dropdown questions :

Q1 - Which continent do you live on ?
A1 - AMERICA
A2 - EUROPE

Q2 - Which country do you live in ?
A11 - United-States [disp. only if Q1 == "AMERICA"]
A12 - Canada [disp. only if Q1 == "AMERICA"]
A21 - France [disp. only if Q1 == "EUROPE"]
A22 - Germany [disp. only if Q1 == "EUROPE"]

Q3 - Which city do you live in ?
A111 - New-York [disp. only if Q2 == "United-States"]
A112 - Los Angeles [disp. only if Q2 == "United-States"]
A121 - Ottawa [disp. only if Q2 == "Canada"]
A122 - Montreal [disp. only if Q2 == "Canada"]
A211 - Paris [disp. only if Q2 == "France"]
A212 - Lyon [disp. only if Q2 == "France"]
A221 - Berlin [disp. only if Q2 == "Allemagne"]
A222 - Munich [disp. only if Q2 == "Allemagne"]

I'm using LimSurvey 2.50+ Build 160529 and I would strongly prefer the questions to be on the same page. I would be very grateful for any kind of help. If someone could just send me a .lss that do the trick it would be absolutely perfect.

Thank you !

Anaëlle
Last edit: 7 years 10 months ago by energiejeunes.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #137252 by DenisChenu
Replied by DenisChenu on topic Dropdown answers based on previous answers
Hi,

No : here you want dropdown, other solution use radio.

I have a soilution wioth 2.06, but surely can work with 2.50 . Plugin in WIP here : framagit.org/SondagePro-LimeSurvey-plugin/selectFilter

See example (in french) : demonstration.sondages.pro/565163?newtest=Y# (2nd group use 3 dropdown)

Attached lss file

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
7 years 10 months ago - 7 years 10 months ago #137421 by vkuzmin
Replied by vkuzmin on topic Dropdown answers based on previous answers
Easy way: you can make more questions with "Group by group" option selected.

Q1 - Which continent do you live on ?
A1 - AMERICA
A2 - EUROPE

Q2A - Which country do you live in ?
A11 - United-States [disp. only if Q1 == "AMERICA"]
A12 - Canada [disp. only if Q1 == "AMERICA"]

Q2E - Which country do you live in ?
A21 - France [disp. only if Q1 == "EUROPE"]
A22 - Germany [disp. only if Q1 == "EUROPE"]

Q3AU - Which city do you live in ?
A111 - New-York [disp. only if Q2A == "United-States"]
A112 - Los Angeles [disp. only if Q2A == "United-States"]

Q3AC - Which city do you live in ?
A121 - Ottawa [disp. only if Q2A == "Canada"]
A122 - Montreal [disp. only if Q2A == "Canada"]

Q3EF - Which city do you live in ?
A211 - Paris [disp. only if Q2E == "France"]
A212 - Lyon [disp. only if Q2E == "France"]

Q3EA - Which city do you live in ?
A221 - Berlin [disp. only if Q2E == "Allemagne"]
A222 - Munich [disp. only if Q2E == "Allemagne"]

After that open "List questions" - click "Question Summary" on the one of new questions (Q2A for example) - click "Set Conditions" button and repeat for other questions
Last edit: 7 years 10 months ago by vkuzmin.
The topic has been locked.
More
7 years 3 weeks ago #151239 by reinhane
Replied by reinhane on topic Dropdown answers based on previous answers
Hi Denis,


"I have a soilution wioth 2.06, but surely can work with 2.50 . Plugin in WIP here : framagit.org/SondagePro-LimeSurvey-plugin/selectFilter "

Is it still possible to get this script? Seems to be not available anymore behind the link. I Have a problem similar to the one from Anaëlle but with a very large number of answer options. In fact I want to ask at which university one studies.

Two dropdown questions:


Q1: Choice of city in which the university is:

A1: City
...
A85: City

Q2: Which university of the city:

A11: university
A12: university
...
A17: university
A21: university
A22: university
...
A25: university

and so on...

I know that there are already a view topics dealing with this problem, but I'm a complete newbie in Limesurvey and also in JAVA script.

I found this solution for example but I do not know what I have to change to make the script search for names of Cities and/or universities.

manual.limesurvey.org/Workarounds:_Manip..._Javascript#Method_2

Also this one but with the same problem for me. Where do I have to enter my answer options?


demonstration.sondages.pro/upload/templa...nade/selectfilter.js

Any help would be much appreciated and sorry again for repeating the question.

regards
Nepomuk
The topic has been locked.
More
7 years 3 weeks ago #151240 by jelo
You might check another plugin from Denis as well.
framagit.org/SondagePro-LimeSurvey-plugin/cpVille

There are a few threads here about adapting this plugin.
www.limesurvey.org/forum/can-i-do-this-w...cading-combos#149524

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 weeks ago #151242 by DenisChenu
Replied by DenisChenu on topic Dropdown answers based on previous answers
Hi,

1st : framagit.org/SondagePro-LimeSurvey-plugi...sets/selectfilter.js

2nd : about code : better to use A01 and not A1, because A1 is same than A11

Can try
A0101
A0102
A0103
....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
7 years 3 weeks ago #151261 by reinhane
Replied by reinhane on topic Dropdown answers based on previous answers
Hi,

first of all thank you very much for your pretty fast answers. Both were very helpful. The "selectfilter" script is exactly what I need because I have several questions which require a two level dropdown menu in my survey.

But as I already mentioned before, I'm a complete idiot in programming. So the next question might seem very stupid to you and I really do not want to bother you but I would appreciate an answer anyway:

Example of my question design:

1st level dropdown "list of 85 Cities"
2nd level dropdown "list of 1-5 Universities for every city in the list above"

I understand what "qid"(second list) and "filterqid" (first list) is, but I don't know how to link the universities to the cities. I mean I have to add an ID to every universitiy which is identical with an ID of the city in which the university is, right?

Is this the normal answer ID field or do I have to insert something in the script? Or is it possible to use CSV? (In this case I have to mention that I do not have a local installation but instead use one on a server hosted by my university...)

Thank you very much for your help!

Nepomuk
The topic has been locked.
More
7 years 3 weeks ago #151273 by Ben_V
Replied by Ben_V on topic Dropdown answers based on previous answers
Hi,
If it can help you, please try to install the survey sample & required files provided here:
www.limesurvey.org/forum/can-i-do-this-w...combos/149942#149942

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 weeks ago #151304 by DenisChenu
Replied by DenisChenu on topic Dropdown answers based on previous answers
Coorespondance by answer code .

A01 for town show A01XX for university

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
7 years 3 weeks ago #151340 by reinhane
Replied by reinhane on topic Dropdown answers based on previous answers
Hello again,

thank you again for your answers, I implemented averything and the design works but it does not filter anything. It shows all answers of question two all the time. I also tried the "Municipios Espana" sample but with the same result, no filtering in the second dropdown.

Maybe some global setting is wrong? I tried everything...

I attached a question group with two small test questions maybe somebody can take a short look at it?!?

And btw I work with Limesurvey Version 2.06+ Build 160129

Many thanks to all of you helping me out!

Nepomuk

File Attachment:

File Name: limesurvey...1460.lsg
File Size:18 KB
The topic has been locked.
More
7 years 3 weeks ago #151341 by reinhane
Replied by reinhane on topic Dropdown answers based on previous answers
Addition to my last post:

Meanwhile I found out that I have to ad a function call like that:

<script type="text/javascript" charset="utf-8">
selectFilterByCode(qID,filterqID);
</script>

I added it in the description field of the question group (only the two questions inside) but the filtering still doesn't work. Do I have to add something in the source field of the two questions too?
The topic has been locked.
More
7 years 3 weeks ago #151343 by reinhane
Replied by reinhane on topic Dropdown answers based on previous answers
Ok it's me again,

I'm still trying to fix the thing by myself and now I have to confess that it seems that I DO NOT know what to enter for qID and filterqID

Because when I put in nothing, I have the same result as before: Design ok, filtering doesn't work

I added the whole testing survey and a .txt with the code including the IDs that THINK are the correct ones. It is not the self chosen "Code" where I chose "Q00001" it is the ID with 5 numbers that is created automatically by limesurvey, yes or no? (but I tested both and it did'nt work)

File Attachment:

File Name: limesurvey...2644.lss
File Size:32 KB

File Attachment:

File Name: SelectFilt...Test.txt
File Size:5 KB


But even with this ID it doesn't work. And all the options in question two are shown in the dropdown, even if I do not choose anything in question one. Seems to me that the whole filtering part of the script isn't activated in the right way.

:-((

One last tipp please!

Nepomuk
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose