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'.
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.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
<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>
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?
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.