- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Condition doesnot work when controlling group order
- kzzz_520
- Topic Author
- Offline
- New Member
Less
More
1 week 2 days ago #261203
by kzzz_520
Condition doesnot work when controlling group order was created by kzzz_520
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.5.4
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Dear LimeSurvey community,
I have a question regarding survey design. I would like respondents to make 2 group of random order choices. In each group, they first need to choose their preferred housing, and then, select their preferred mode of transportation. It's a combination of a random question and a fixed question. I have learned from Tpartner’s code in other’s topic, which is a JavaScript/CSS solution. It works very effectively for displaying the process of selecting housing and transportation options.
However, I encountered a issue. In each group, I hope the answer to the first question can influence the display of the second question. That is to say, if they choose housing A (new housing) or housing B (new housing), they will be presented with the transportation mode selection question. If they choose housing C (maintain current situation), they will not be presented with the transportation mode selection question.I edited the conditions of the transportation mode selection question to show/hide it. But it malfunctioned. If housing C (current situation) is selected, the transportation mode selection question still appears. I'm confuse how to make it work. Do I need to resolve it through programming? I don't have a programming background and don't know how to proceed.
Another issue I have is that I don't want to display the 'Previous' button during these two group to prevent them from going back and modifying their previous answers. And in other questions of the survey, the 'Previous' button is still needed.
I am not sure if there is a way to solve these problem. Maybe you can help me! Please let me know if you need more information. Thank you so much!
Your LimeSurvey version: 6.5.4
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Dear LimeSurvey community,
I have a question regarding survey design. I would like respondents to make 2 group of random order choices. In each group, they first need to choose their preferred housing, and then, select their preferred mode of transportation. It's a combination of a random question and a fixed question. I have learned from Tpartner’s code in other’s topic, which is a JavaScript/CSS solution. It works very effectively for displaying the process of selecting housing and transportation options.
However, I encountered a issue. In each group, I hope the answer to the first question can influence the display of the second question. That is to say, if they choose housing A (new housing) or housing B (new housing), they will be presented with the transportation mode selection question. If they choose housing C (maintain current situation), they will not be presented with the transportation mode selection question.I edited the conditions of the transportation mode selection question to show/hide it. But it malfunctioned. If housing C (current situation) is selected, the transportation mode selection question still appears. I'm confuse how to make it work. Do I need to resolve it through programming? I don't have a programming background and don't know how to proceed.
Another issue I have is that I don't want to display the 'Previous' button during these two group to prevent them from going back and modifying their previous answers. And in other questions of the survey, the 'Previous' button is still needed.
I am not sure if there is a way to solve these problem. Maybe you can help me! Please let me know if you need more information. Thank you so much!
Attachments:
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12996
- Thank you received: 3999
1 week 2 days ago #261207
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Condition doesnot work when controlling group order
Hi,
this approach with "subgroup-1" and "subgroup-2" was something different.
You only have two groups, displayed in randomized order by the randomization group name
and a question that depends on the answer of the previous question.
You only use something like the old "green apple - banana" example with a condition on the next question
And in the second group you just copied the condition. Here it depends on task3.
Joffm
P.S.
I did not see the code for the popover
Nor did I see where and why you want to use the "hideEmptyColumn" plugin.
this approach with "subgroup-1" and "subgroup-2" was something different.
You only have two groups, displayed in randomized order by the randomization group name
and a question that depends on the answer of the previous question.
You only use something like the old "green apple - banana" example with a condition on the next question
And in the second group you just copied the condition. Here it depends on task3.
I think because your condition didn't contain blanks between the operators.the transportation mode selection question still appears. I'm confuse how to make it work
Not really an issue, but a wish.Another issue I have is that I don't want to display the 'Previous' button during these two group to prevent them from going back and modifying their previous answers.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#ls-button-previous').hide(); }); </script>
Joffm
P.S.
I did not see the code for the popover
Nor did I see where and why you want to use the "hideEmptyColumn" plugin.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: kzzz_520
Please Log in to join the conversation.
- kzzz_520
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 week 2 days ago #261240
by kzzz_520
Replied by kzzz_520 on topic Condition doesnot work when controlling group order
Thank you Joffm! Thank you very much for your prompt guidance. And I think I've solved my second issue. But for the first one, I want to explain more.
In each group, I use CSS classes 'subgroup-1' and 'subgroup-2' to differentiate the two questions because I want them to appear on different pages. The process I want to achieve is: respondents answer task 1 ---> click 'Next' ---> answer task 2. This way, when respondents see task 2, they cannot go back to modify their answers for task 1. In this way, transportation choices will not affect housing choices.So I want to keep the previous CSS and Java settings. And on this basis, solve the problem of making the condition take effect.
Also sorry for my problem with my previous condition settings.What you sent is correct.
In each group, I use CSS classes 'subgroup-1' and 'subgroup-2' to differentiate the two questions because I want them to appear on different pages. The process I want to achieve is: respondents answer task 1 ---> click 'Next' ---> answer task 2. This way, when respondents see task 2, they cannot go back to modify their answers for task 1. In this way, transportation choices will not affect housing choices.So I want to keep the previous CSS and Java settings. And on this basis, solve the problem of making the condition take effect.
Also sorry for my problem with my previous condition settings.What you sent is correct.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
1 week 2 days ago - 1 week 2 days ago #261242
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Condition doesnot work when controlling group order
Leave the relevance equation for task2 in place.
Change the "Next" listener in your script:
To this:
Code:
task1_Y001.NAOK=="X001" OR task1_Y001.NAOK=="X002"
Change the "Next" listener in your script:
Code:
// Listener on the "Next" button $('#ls-button-submit').on('click', function(e) { if($('.sub-group-1:visible').length > 0) { e.preventDefault(); $('.sub-group-1').hide(); $('.sub-group-2').show(); // Remove the line below to keep the "Next" button enabled // $('#ls-button-submit').prop('disabled', true); } });
To this:
Code:
// Listener on the "Next" button $('#ls-button-submit').on('click', function(e) { if($('.sub-group-1').is(':visible') && !$('.sub-group-2').hasClass('ls-irrelevant')) { e.preventDefault(); $('.sub-group-1').hide(); $('.sub-group-2').show(); } });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 1 week 2 days ago by tpartner.
The following user(s) said Thank You: kzzz_520
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
1 week 2 days ago - 1 week 2 days ago #261243
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Condition doesnot work when controlling group order
Stupid, stupid editor!
Replace && with &&.
Replace && with &&.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 1 week 2 days ago by tpartner.
The following user(s) said Thank You: kzzz_520
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12996
- Thank you received: 3999
1 week 2 days ago #261246
by Joffm
This is a terrible behaviour of this editor
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Condition doesnot work when controlling group order
Replace && with &&.
This is a terrible behaviour of this editor
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- kzzz_520
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 week 1 day ago #261698
by kzzz_520
Replied by kzzz_520 on topic Condition doesnot work when controlling group order
Thank you so so much Tony Partner and Joffm! For your outstanding work and professionalism!
Please Log in to join the conversation.