Check out the LimeSurvey source code on GitHub!

Capturing randomization order

More
3 years 2 months ago #102039 by itsdanwall
I am trying to determine if the question order and the order of answer options for the attached survey. There is randomization on which side each answer option is presented (via the "Random order: Randomize on each page load" within the question options). Further the questions themselves are presented in a random order (via the "Randomization group" within the question group options). I would like to be able to capture both the side of the answer options were presented on and the order which the questions were presented. Is there a way to do this in LimeSurvey?

Note: I used the "copy_of_default.zip" template to make List(radio) questions appear horizontally.
Attachments:

Please Log in to join the conversation.

More
3 years 2 months ago #102047 by holch
without having had a look at your files, I'd say no, not out of the box. At least I am not aware of any feature like this.

Maybe one can do something with Javascript writing the order into a hidden question field, but I think this will be quite complicated.

Would be great if anyone could proof me wrong though...

But this would probably require an additional column in the database for each question and each answer item, which would bring us quickly to the column limits of the database engines, especially for bigger surveys and/or long item lists, where the randomization is most important.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
3 years 2 months ago #102334 by itsdanwall
Do you know of any resources for me to begin to understand how to use JavaScript to write the random order to a hidden question field?

Please Log in to join the conversation.

More
3 years 2 months ago #102345 by holch
Sorry, I am not a Javascript expert.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #102364 by tpartner
To record the group display order, you can add a hidden equation type question to each group and load it with the equation below. This records the sequential number of the group (I have added 1 so the sequence starts at 1)
{self.gseq + 1}


Recording the radio answer order is a little trickier...

1) Set up your survey to use JavaScript .

2) Add a short-text question to each group (we'll hide them with JavaScript).

3) Add the following script to the source of each short-text. This script:
- Hides the short-text question
- Loops through the radio options as displayed
- Records a comma-separated list of their answer IDs in the short-text
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		// Identify some stuff
		var qHiddenID = {QID}; // The hidden question ID
		var qHidden = $('#question'+qHiddenID); // The hidden question
		var q1 = $('div.list-radio:eq(0)'); // First radio question on the page
		var q1ID = $(q1).attr('id').split('question')[1]; // The first radio question ID
		var gID = $('input.text', qHidden).attr('id').split('X')[1]; // The group ID
 
		// Hide this question
		$(qHidden).hide();
 
		// Build an array of the Q1 answers
		var answersArr = new Array();
		$('input.radio', q1).each(function(i){
			var answerID = $(this).attr('id').split('X'+gID+'X'+q1ID)[1];
			answersArr.push(answerID);
		});
 
		// Load the array into the hidden question
		$('input.text', qHidden).val(answersArr);
	});
</script>


Here's your sample survey back with these modifications:

File Attachment:

File Name: limesurvey...fied.lss
File Size:37 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 3 years 2 months ago by tpartner.
The following user(s) said Thank You: first

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form