Filter currentdrop down list values based on a previous drop down list selection

More
1 month 4 days ago - 1 month 4 days ago #172748 by giannopk
giannopk created the topic: Filter currentdrop down list values based on a previous drop down list selection
Hi, I am running limesurvey 1.92 (I cannot update currently)

I have two drop down list questions A and B.

When the user Selects a value from the drop down list of question A, I want the values of the drop down list of the question B, to be filtered accordingly.

Can I do this somehow?
I would like to avoid having to use javascript like this manual.limesurvey.org/Workarounds:_Manip..._Javascript#Method_2


Note, I have previously done it using multiple drop down list questions for B, each of them with its own list values. And each of them to be shown only when a particular selection is done in the list of the question A.
The problem is that when I export the results, even the empty questions are shown, whereas I need only one question to be shown with the selected value at the export table.
That is why I am asking the above.
Last Edit: 1 month 4 days ago by giannopk.

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago #172751 by Joffm
Joffm replied the topic: Filter currentdrop down list values based on a previous drop down list selection
Hi,

The problem is that when I export the results, even the empty questions are shown

Okay, that's obvious.

But it's just a little bit of work to rearrange the values in your analyzing tool (macro in EXCEL, recode in SPSS, or so)
If you don't want to use the JS workaround, that's the disadvantage.

But you can try the following:
create a multipunch question with the codes of question B (QMB).
create a question of type equation.
In the equation set all codes of QMB to true which refer to the answer of question A
{QMB_1=if(Q1 == 1,"Y","")}
{QMB_2=if(Q1 == 2,"Y","")}
{QMB_3=if(Q1 ==1,"Y","")}
{QMB_4=if(Q1 ==3,"Y","")}
...
Then use QMB as array filter for question B.
Both question should be hidden.

Joffm


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

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago - 1 month 4 days ago #172753 by giannopk
giannopk replied the topic: Filter currentdrop down list values based on a previous drop down list selection
Thanks for your fast response!

I cannot use the XLS because the data will be programmatically manipulated later on. Instead of altering the code, I thought if it can be done in limesurvey.

The solution you mention seems a bit complicated, but I will try it for sure if there is no other option.

I am trying now a thought I had:
Use multiple questions for B and show one of them, depended on the selection that has been done in A. (straight forward in limesurvey)
Then, insert another hidden question C (short text) where it's default answer will be automatically filled using as an answer the value of B code (for example {B}). But of course there will be several B questions now, all empty except of one of them.
I am not sure if I can input {B1};{B2};{B3} yet.
But if I can, then only one B value will be the answer of C since the other Bs will be empty.
Note, the C must be in another question group for this to work.

Then I can only look my question C programmatically to extract the value.

Sounds complicated?
Last Edit: 1 month 4 days ago by giannopk.

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago - 1 month 4 days ago #172754 by Joffm
Joffm replied the topic: Filter currentdrop down list values based on a previous drop down list selection
Hi,
well it sounds complicated for somebody who is not familiar with this.
If you study the example you will see that it is really straightforward.

Here is the example (created in LS 2.06).

Problem: There is no array filter in dropdown list, only in radio list.

File Attachment:

File Name: single_single.lss
File Size:34 KB




Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last Edit: 1 month 4 days ago by Joffm.

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago #172757 by giannopk
giannopk replied the topic: Filter currentdrop down list values based on a previous drop down list selection
Thanks a lot, I will try it.

Meanwhile I have tested the Idea I had and it seems it works.

The default answer for C must be set to {B1.shown}{B2.shown}{B3.shown} with Bx to represent the code of each of the questions (lists) that appear to the user dependend on the A choice.

Question C must be in a separate question group.

To disable the user to edit this question (short text type), I set the timer to 1 second and the action to "Move on without warning". This makes the group page (with question C pre-filled) to appear for 1 second, then it automatically moves to the next group page.

Maybe there is a better option to just disable the fill-in of the short text question? Or even change the question type so that the user cannot type in?
This way I can get away of using the timer.
Any ideas?

*Thanks for all the precious help!

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago - 1 month 3 days ago #172815 by giannopk
giannopk replied the topic: Filter currentdrop down list values based on a previous drop down list selection
I have tested another way as well which works even better and I am writing here for future references.

Make the question C to be of "Equation" type.
In it's description write {B1.shown}{B2.shown}
Question C does not need to be in a separate group now and no timer need to be set.

Upon survey submission C stores the values of B1 and B2, one of each is empty (so only one string is stored), because only one of these equations is filled each time, due of the conditions set on these questions by the selection of the list in A.

No javascript. Enjoy.


*maybe you need to allow javascript in the question editor, I had already enabled this before www.limesurvey.org/forum/can-i-do-this-w...script-to-a-question
Last Edit: 1 month 3 days ago by giannopk.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!