Welcome to the LimeSurvey Community Forum

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

Cascading combos

  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #149443 by mpac_limes
Cascading combos was created by mpac_limes
Hi everybody!

I want to filter some dropdown list questions depending on previous questions in the same section. Let's see an example...

Q1: Countries
Australia
Belgium
Croatia
Denmark
...

Q2: Cities
Brussels
Copenhagen
Perth
Sidney
Zagreb

Q3 Districts, Q4 Streets....

If the user selects Australia in Q1 the only visible options in Q2 should be Sidney and Perth

I've done this before over older versions of LS with some dirty and obscure javascript hacks. I hoped that in 2.63. that very same job could be done in an elegant way.

Does somebody know a simple way to get this filtering working?

Thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #149453 by tpartner
Replied by tpartner on topic Cascading combos

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, mpac_limes
The topic has been locked.
More
7 years 8 months ago #149454 by jelo
Replied by jelo on topic Cascading combos

mpac_limes wrote: Does somebody know a simple way to get this filtering working?

Tpartners idea sounds like the best workaround approach. You didn't state how big each list it.

Subquestionrelevance is not working with Dropdown, which would be a way to go when having not that many items per answerset.

A way to build dynamic answersets would be nice.
bugs.limesurvey.org/view.php?id=11688

Or you open a feature request for a drill-down question type. Which is 100% what you're looking for:
www.qualtrics.com/support/survey-platfor...uestions/drill-down/

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: mpac_limes
The topic has been locked.
  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #149468 by mpac_limes
Replied by mpac_limes on topic Cascading combos
I'm migrating quite a few surveys from LS 1.87 to 2.63 and updating and refactoring them in the process. Sometimes there would be lots of answers for the dropdown list, and autocomplete can be the reasonable solution there. Nevertheless, other questions have more limited answers and drill-down questions could do the job quite well without the extra setup needed for the jquery autocomplete.

I'll try the autocomplete approach first but I could definitely use the drill-down question too. Apparently I can't request the feature without a mantis user though.

Thank you tpartner and jelo.
The topic has been locked.
More
7 years 8 months ago - 7 years 8 months ago #149475 by Ben_V
Replied by Ben_V on topic Cascading combos
Hi,

This reminds me a great (javascript-based) survey sample provided by Tony... years ago !!!

www.limesurvey.org/community-services/fo...-of-a-dropdown#90731

One of my fav !

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)
Last edit: 7 years 8 months ago by Ben_V.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 8 months ago #149524 by DenisChenu
Replied by DenisChenu on topic Cascading combos
In fact : base of cpVille can be 'easily' adapted for another database, maybe a 'countryTown' can be great here, but the database are .... really great.

Have a countryTown in 2 parts seems to be a good idea : 'select country' + 'select town' mùaybe in a multiple text question type or 2 short text ?

I have another plugin idea where :
- Using a single choice question type
- Remove the default dropdown and put a empty dropdown (or with one value if there are already a value set)
- Use this dropdown with a remote call to get the filtered value
- Update the 'answers' part when sublitting

After
- If admin user export response in text : the real name is shown
- BUT : if admin user try to look or update 'answers' : this surely break .... if there are a lot of answers : this surely break the survey logic file too (if you nhave , for example 2000 town)

Alternative solution for exporting : make own export plugin.....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
7 years 8 months ago - 7 years 8 months ago #149942 by Ben_V
Replied by Ben_V on topic Cascading combos

Ben_V wrote: This reminds me a great (javascript-based) survey sample provided by Tony... years ago


I found another old useful post showing @DenisChenu 's amazing method for dropdown cascading management (remember that there is no relevance field at answer options level for this question type):

www.limesurvey.org/en/community-services...list-via-java-script

A live (basic) example is available here:

s465379752.mialojamiento.es/419299

BTW I attach the related lss sample + complete folder containing all required resources (have to be uploaded in your template folder).
/!\ made under 2.06 & not tested with 2.6x (requires adaptation probaly to place the ressources outside the template folder)

Hope this could help users dealing with spanish regions & other people needing starting with cascading combos ;)


File Attachment:

File Name: municip_esp.zip
File Size:139 KB

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)
Attachments:
Last edit: 7 years 8 months ago by Ben_V.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 8 months ago #149982 by DenisChenu
Replied by DenisChenu on topic Cascading combos
Currently : have the project to make a cleaner plugin for this : framagit.org/SondagePro-LimeSurvey-plugin/selectFilter

Near same javascript, but add it in "question advanced settings : filter by 'questioncode' "

framagit.org/SondagePro-LimeSurvey-plugin/selectFilter

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: Ben_V
The topic has been locked.
More
7 years 2 months ago #158538 by bremont
Replied by bremont on topic Cascading combos
Hi, I downloaded and installed your pluguin but I do not know how to use it, you can help me
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 2 months ago #158563 by DenisChenu
Replied by DenisChenu on topic Cascading combos
Not ready currently, but for example

If you have QCODE with code A,B,C
you can filter dropdown2 with answer code A1,A2,A3,B1,B2,B3 … adding a javascript line
Code:
selectFilter_selectFilterByCode({QID},{QCODE.qid})

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose