- Posts: 12
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
fill ranking array with answers from previous question
- stigchelg
- Offline
- New Member
Less
More
12 years 6 months ago - 12 years 6 months ago #65984
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
WOOHOO SUCCESSSSSS!!!
Well partly anyway.
I started from scratch and now I have a working construct.
3 multiple options quesions that collect their anwers into one collection question. This collecting then serves as the source of the filter array that fills the ranking question.
A new problem arises though. The collection question, the source for the filter array and the filter array itself are obviously for technical reasons only. I had thought to hide them onces the whole thing is done. However when I hide either one of these, the construct stops working. If I hide the collection question, the source question won't prefill so the filter array filters nothing and the ranking question is filled with all possible options.
In short, how do I hide questions from the viewer, but still make them available for filtering and such?
Well partly anyway.
I started from scratch and now I have a working construct.
3 multiple options quesions that collect their anwers into one collection question. This collecting then serves as the source of the filter array that fills the ranking question.
A new problem arises though. The collection question, the source for the filter array and the filter array itself are obviously for technical reasons only. I had thought to hide them onces the whole thing is done. However when I hide either one of these, the construct stops working. If I hide the collection question, the source question won't prefill so the filter array filters nothing and the ranking question is filled with all possible options.
In short, how do I hide questions from the viewer, but still make them available for filtering and such?
Last edit: 12 years 6 months ago by stigchelg.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
12 years 6 months ago #65988
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 fill ranking array with answers from previous question
If you hide them with JavaScript the code should work. In fact, the code is already set to hide the multi-opt on the same page as the ranking:
Code:
if(prevPage == 1) { $('#question'+q1ID+' li[id^="javatbd"]:visible input.checkbox').attr('checked', true); $('#question'+q1ID+'').hide(); }
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- stigchelg
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 6 months ago #65997
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
Ok, I'll give that a go.
Can the script be adapted to read from 3 source questions on 3 different pages instead of just 1? I'm thinking it probably can, but will that require a complete rewrite or do I simply add a q2ID and a q3ID whereever I see the q1ID marker pop up? That way I eliminate the need for hiding questions alltogether.
Can the script be adapted to read from 3 source questions on 3 different pages instead of just 1? I'm thinking it probably can, but will that require a complete rewrite or do I simply add a q2ID and a q3ID whereever I see the q1ID marker pop up? That way I eliminate the need for hiding questions alltogether.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
12 years 6 months ago #66001
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 fill ranking array with answers from previous question
That should be possible - you would need to use {INSERTANS} (or cookies) to retrieve the previous answers and then check the appropriate boxes in the multi-opt on page 5.Can the script be adapted to read from 3 source questions on 3 different pages
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- stigchelg
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 6 months ago #66027
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
Hmm. Ok. That's just a little above my head. No matter. Hiding the questions is fine. However, when I hide the questions I don't need with
<script> $(document).ready(function() { $('#question4444').hide(); });</script>
where I replace question4444 with the ID of the actual question. This hides the question just fine, but now I'm left with an empty page to click through. Any way to fix that?
<script> $(document).ready(function() { $('#question4444').hide(); });</script>
where I replace question4444 with the ID of the actual question. This hides the question just fine, but now I'm left with an empty page to click through. Any way to fix that?
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
12 years 6 months ago #66034
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic fill ranking array with answers from previous question
You could either switch to group-by-group or all-in-one survey mode or add another line of JS code if you are using question-by-question format. That code could click the "next" button so the hidden question would be skipped automatically.
See docs.limesurvey.org/Workarounds%3A+Manip...ing_the_welcome_page for example.
See docs.limesurvey.org/Workarounds%3A+Manip...ing_the_welcome_page for example.
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- stigchelg
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 6 months ago #66057
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
Hmm, ok I tried this and it does work as describe only that page flash is a bit strange even with a fake loading text. Surely there is a more elegant solution.
This may be the stupid question of the week, but why can't I just route past these questions? When question 3 has been answers, skip straight to question 5.
Oh and even though the construct works now, I'm still having trouble. I can only get it to prefill from a question on the same page. When I change it with the ID of the question on the previous page and add ", 1" to the small script, It doesn't work.
This may be the stupid question of the week, but why can't I just route past these questions? When question 3 has been answers, skip straight to question 5.
Oh and even though the construct works now, I'm still having trouble. I can only get it to prefill from a question on the same page. When I change it with the ID of the question on the previous page and add ", 1" to the small script, It doesn't work.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
12 years 6 months ago #66072
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic fill ranking array with answers from previous question
Javascript reads out the information from the source code (DOM objects) of the currently displayed page. Therefore you can only access items which are listed on the same page.stigchelg wrote: Oh and even though the construct works now, I'm still having trouble. I can only get it to prefill from a question on the same page. When I change it with the ID of the question on the previous page and add ", 1" to the small script, It doesn't work.
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
12 years 6 months ago #66094
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 fill ranking array with answers from previous question
This should help get rid of the flash.
But if you use this workaround and are allowing the "Previous" button, you may need to add a script to the following page so that if the "Previous" button is clicked the hidden question group is also skipped.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('body').hide(); $('form#limesurvey').submit(); }); </script>
But if you use this workaround and are allowing the "Previous" button, you may need to add a script to the following page so that if the "Previous" button is clicked the hidden question group is also skipped.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- stigchelg
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 6 months ago #66299
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
Ok, after a weekend of testing and cursing. I am satisfied with the result. I have moved on to the next project in line which is a multiple numerical with slider lay-out. How can I filter this type of question? It also does not have the filter array option.
BTW Tpartner. Are you in anyway affiliated with Limesurvey?
BTW Tpartner. Are you in anyway affiliated with Limesurvey?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
12 years 6 months ago #66357
by tpartner
I'm only affiliated as a volunteer on the development team.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic fill ranking array with answers from previous question
I think I already answered that - www.limesurvey.org/forum/can-i-do-this-w...art=30&lang=en#59877...which is a multiple numerical with slider lay-out. How can I filter this type of question?
I'm only affiliated as a volunteer on the development team.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- stigchelg
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 5 months ago #66627
by stigchelg
Replied by stigchelg on topic fill ranking array with answers from previous question
I've tried this workaround, but I don't see how it pertains to my problem. I may be missing the point entirely, but how does this add a filter array to a multiple numerical question?
I'll just ago ahead and make a donation then. If it doesn't benefit your directly, it'll do some good somewhere in the development I guess .
I'll just ago ahead and make a donation then. If it doesn't benefit your directly, it'll do some good somewhere in the development I guess .
The topic has been locked.