- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Partially randomized array in 3.*
- dangerdangerhighvoltage
- Topic Author
- Offline
- New Member
Less
More
4 years 5 months ago - 4 years 5 months ago #189501
by dangerdangerhighvoltage
Partially randomized array in 3.* was created by dangerdangerhighvoltage
Hello helpful limesurvey forum
As always i tried to search the forum before, but the search wasn't fruitful. Neither is their an entry for this in the workaround documentation.
I want to randomize an array, but fix a certain amount of subquestions at the end (4 to be precise). Sadly, my whole experience with javascript is copying scripts from the documentation and slightly changing them. Is there such a thing and i am just blind, or can anyone avid with javascript experience help me out here? Much appreciated.
As always i tried to search the forum before, but the search wasn't fruitful. Neither is their an entry for this in the workaround documentation.
I want to randomize an array, but fix a certain amount of subquestions at the end (4 to be precise). Sadly, my whole experience with javascript is copying scripts from the documentation and slightly changing them. Is there such a thing and i am just blind, or can anyone avid with javascript experience help me out here? Much appreciated.
Last edit: 4 years 5 months ago by dangerdangerhighvoltage.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 5 months ago #189503
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 Partially randomized array in 3.*
Can you attach a small sample survey (.lss file) containing only the relevant question?
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: dangerdangerhighvoltage
The topic has been locked.
- dangerdangerhighvoltage
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
4 years 5 months ago #189509
by dangerdangerhighvoltage
Replied by dangerdangerhighvoltage on topic Partially randomized array in 3.*
Yes, i can.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 5 months ago - 4 years 5 months ago #189518
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 Partially randomized array in 3.*
He, he, I like the survey title.
Add a script like this to the question source:
Here is your sample survey back with that script inserted:
Add a script like this to the question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // List of sub-question codes to be pinned to the bottom (in order) var sqCodes = ['8', '9', '10', '11']; // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Loop through the sub-question codes and reposition the corresponding row $.each(sqCodes, function(i, val) { var thisRow = $('tr[id^="javatbd"][id$="X'+qID+val+'"]'); $('table.subquestion-list tbody:last', thisQuestion).append(thisRow); }); }); </script>
Here is your sample survey back with that script inserted:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 5 months ago by tpartner.
The following user(s) said Thank You: dangerdangerhighvoltage
The topic has been locked.