Partially Randomized Answers For Array Typed Questions

More
4 years 3 months ago - 4 years 3 months ago #92002 by david2013
david2013 created the topic: Partially Randomized Answers For Array Typed Questions
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
Attachments:
Last Edit: 4 years 3 months ago by david2013. Reason: Grid doesn't appear properly

Please Log in to join the conversation.

More
4 years 3 months ago #92069 by tpartner
tpartner replied the 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):
<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.

Please Log in to join the conversation.

More
4 years 3 months ago #92647 by david2013
david2013 replied the topic: Partially Randomized Answers For Array Typed Questions
Thank you very much

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now