- Posts: 54
- Thank you received: 7
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Partially Randomized Answers For Array Typed Questions
- david2013
- Topic Author
- Offline
- Senior Member
Less
More
11 years 1 month ago - 11 years 1 month ago #92002
by david2013
Partially Randomized Answers For Array Typed Questions was created by david2013
There is Javascript workaround for Multiple Options & List (radio) questions if you want to partially randomized answers. I'm wondering can we do something similar to Array Type questions? See below, can we randomize first 5 attributes but keep other at the end? Also, can we add "other" option to the grid too so that respondent can enter some text?
1 2 3 4 5
Attribute 1
Attribute 2
Attribute 3
Attribute 4
Attribute 5
Other
1 2 3 4 5
Attribute 1
Attribute 2
Attribute 3
Attribute 4
Attribute 5
Other
Attachments:
Last edit: 11 years 1 month ago by david2013. Reason: Grid doesn't appear properly
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
11 years 1 month ago #92069
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 Answers For Array Typed Questions
1) Follow the instructions regarding answer/subquestion codes here -
docs.limesurvey.org/tiki-index.php?page=...List_radio_questions
2) Set your array to "Random answer order"
3) Add this script to the source of the array (this code is for the plain "Array" question and may need to be modified for other question types):
Regarding the "Other" option, you can add a following short-text question that is shown conditionally when an option in that array row is clicked.
2) Set your array to "Random answer order"
3) Add this script to the source of the array (this code is for the plain "Array" question and may need to be modified for other question types):
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify some elements var q1ID = '{QID}'; var q1 = $('#question'+q1ID+''); var tbody = $('tr[id^="javatbd"]:eq(0)', q1).parent(); // Find the number of answers var ansCount = $('tr[id^="javatbd"]', q1).length; // Place the last answer created at the end of the list $('tr[id$="X'+q1ID+ansCount+'"]', q1).appendTo($(tbody)); }); </script>
Regarding the "Other" option, you can add a following short-text question that is shown conditionally when an option in that array row is clicked.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- david2013
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 54
- Thank you received: 7
11 years 1 month ago #92647
by david2013
Replied by david2013 on topic Partially Randomized Answers For Array Typed Questions
Thank you very much
The topic has been locked.