Welcome, Guest
Username: Password: Remember me

TOPIC: Partially Randomized Answers For Array Typed Questions

Partially Randomized Answers For Array Typed Questions 1 year 2 months ago #92002

  • david2013
  • david2013's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Thank you received: 3
  • Karma: 2
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: 1 year 2 months ago by david2013. Reason: Grid doesn't appear properly
The administrator has disabled public write access.

Re: Partially Randomized Answers For Array Typed Questions 1 year 2 months ago #92069

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Partially Randomized Answers For Array Typed Questions 1 year 2 months ago #92647

  • david2013
  • david2013's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Thank you received: 3
  • Karma: 2
Thank you very much
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.113 seconds
Donation Image