- Posts: 53
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Randomise Array subquestions / one fixed at the bottom
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
3 years 6 months ago - 3 years 6 months ago #206626
by PaulMRFGR
Randomise Array subquestions / one fixed at the bottom was created by PaulMRFGR
Hi there,
I'd like to randomise the subquestions within an Array, but have one subquestion fixed so it appears at the bottom all of the time.
Been playing around with the source code all afternoon but can't really get it right - does anyone know what code to use here? I'm not too familiar with coding in general so admittedly that doesn't help - if someone could provide me with the right code and let me know how to change it so it's applicable to different array questions, that would be great.
I'm attaching the .lsg file here. The subquestion that needs to remain fixed at the bottom is 'o'.
Thank you.
I'd like to randomise the subquestions within an Array, but have one subquestion fixed so it appears at the bottom all of the time.
Been playing around with the source code all afternoon but can't really get it right - does anyone know what code to use here? I'm not too familiar with coding in general so admittedly that doesn't help - if someone could provide me with the right code and let me know how to change it so it's applicable to different array questions, that would be great.
I'm attaching the .lsg file here. The subquestion that needs to remain fixed at the bottom is 'o'.
Thank you.
Last edit: 3 years 6 months ago by PaulMRFGR.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 years 6 months ago #206667
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Randomise Array subquestions / one fixed at the bottom
Sorry, won't be of help here. But usually helpers in the forum prefer a LSS file (with just the relevant questions) ofer LSQ or LSG files. Why? Because they require the helper to create a survey and hope that it is the same base language, because LSQ and LSG are language sensitive.
So ideally you copy your survey, delete all quetions that are not relevant and then export it to LSS.
Help us to help you.
So ideally you copy your survey, delete all quetions that are not relevant and then export it to LSS.
Help us to help you.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu, tpartner
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 53
- Thank you received: 0
3 years 6 months ago #206703
by PaulMRFGR
Replied by PaulMRFGR on topic Randomise Array subquestions / one fixed at the bottom
Hi there,
Thanks for the advice - I've now uploaded an .lss file to make it as easy as possible for anyone who feels like they can help.
Thanks again!
Thanks for the advice - I've now uploaded an .lss file to make it as easy as possible for anyone who feels like they can help.
Thanks again!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 6 months ago #206719
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 Randomise Array subquestions / one fixed at the bottom
Place this script in the question source:
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // The sub-question code to be fixed at the end var fixedCode = 'o'; // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Move the "fixed" sub-question $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+fixedCode+'"]', thisQuestion)); }); </script>
Sample survey attached:
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
The topic has been locked.
- PaulMRFGR
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 53
- Thank you received: 0
3 years 6 months ago #206727
by PaulMRFGR
Replied by PaulMRFGR on topic Randomise Array subquestions / one fixed at the bottom
Thanks Tony,
This is really helpful but it doesn't appear to work unfortunately- we've tried uploading your .lss file and putting in the code ourselves. Is it possible that it's a compatibility issue (we're using 2.05+). Not sure if there's any work arounds if it is?
Thank you again!
This is really helpful but it doesn't appear to work unfortunately- we've tried uploading your .lss file and putting in the code ourselves. Is it possible that it's a compatibility issue (we're using 2.05+). Not sure if there's any work arounds if it is?
Thank you again!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 6 months ago #206750
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 Randomise Array subquestions / one fixed at the bottom
Try this in 2.05 (working from memory so untested):
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // The sub-question code to be fixed at the end var fixedCode = 'o'; // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Move the "fixed" sub-question $('table.subquestions-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+fixedCode+'"]', thisQuestion)); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.