Check out the LimeSurvey source code on GitHub!

keep order of response in a multiple choice question

More
5 years 2 months ago #68004 by rafael_ur
Hi,

I have a multiple choice question and I need to keep order of response for first three responses. How could I do it?

Many thank,
Rafael

Please Log in to join the conversation.

More
5 years 2 months ago #68027 by Mazi
Simply don't set "randomize answer options" at the advanced question settings :-)


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago #68028 by tpartner
Do you mean the order in which the respondent clicks them?

If so, is the survey in "group by group" mode so you can have a hidden question on the page?

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
5 years 2 months ago #68033 by rafael_ur
Hi Mazi,

What I need is to identify it down first, second and third place on the multiple chice question, I don't want to have to ask three questions single. Is it possible?

Thanks,
Rafael

Please Log in to join the conversation.

More
5 years 2 months ago #68036 by rafael_ur
Hi Tony,

Yes I need the order in which the respondent clicks them.

Thanks,
Rafael

Please Log in to join the conversation.

More
5 years 2 months ago #68041 by tpartner
1) Set up your survey to use JavaScript .

2) Add a short-text question to the page with the multiple-options question.

3) Add the following script to the source of the short-text question. Replace "11" with the multiple-options question ID and "HH" with the short-text question ID .

If a checkbox in the multiple-options question is checked, its answer code is added to an array. When the Next/Submit button is clicked, the array is loaded into the hidden question storing the answer codes listed in order of checking.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var q1ID = 11;
		var qHidden = HH;
 
		$('#question'+qHidden+'').hide();
 
		var q1Answers = new Array();
 
		// Build an array of q1 answers checked
		$('#question'+q1ID+' input.checkbox').click(function(){
			var ansIDArr = $(this).attr('id').split('X'+q1ID+'');
			var ansCode = ansIDArr[1];
			if($(this).attr('checked') == true) {
				q1Answers.push(ansCode);
			}
		});
 
		// Interrupt next/submit function 
		$('#movenextbtn, #movesubmitbtn').click(function(){
 
			$('#question'+qHidden+' input.text').val(q1Answers);
 
			return true;
		});
 
	});
</script>

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
5 years 2 months ago #68051 by Mazi
Thanks for clarifying. Why don't you just use a ranking question?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago #68056 by rafael_ur
Toni,

Fantastic,
this is what I needed.


Many thanks,

Rafael

Please Log in to join the conversation.

More
5 years 2 months ago #68060 by rafael_ur
Mazi,

Could be, but otherwise fills.

Many thanks,
Rafael

Please Log in to join the conversation.

More
5 years 2 months ago #68593 by cegreja
Hi. I find this useful. However, I don't understand how you then make use of the ranked labels. I'd like to apply this script and then select the first option to the formulation of question A, the second choice in question B and the third option in question C, for example. I don't understand how that's done.

I found this in the manual: docs.limesurvey.org/tiki-index.php?page=...estion_for_later_use

However, I don't want it to be randomized. I'd like the three options selected to correspond to 3 different questions.

Thanks a lot

Please Log in to join the conversation.

More
5 years 2 months ago #68633 by tpartner
I'm afraid I don't understand.

Do you want to use conditions to display following questions based on the selections in a multiple-options question?

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
5 years 2 months ago #68650 by cegreja
Lets see: I have a multiple options question with 50 car brands, from which I ask respondents to choose up to 3 that they own. Later (in other page) I want to ask them the following array questions:

«Regarding the first car you have stated to own [BRAND_1], in a scale from 1 to 10, how satisfied are you with the following aspects?»
«Regarding the second car you have stated to own [BRAND_2], in a scale from 1 to 10, how satisfied are you with the following aspects?»
«Regarding the third car you have stated to own [BRAND_3], in a scale from 1 to 10, how satisfied are you with the following aspects?»

I will use conditions to display the appropriate number of questions according to the previously selected items in the multiple options Q.
What I don't understand is how to insert each of the brands selected into the corresponding question text.

(Because I'd like to have only 3 array questions instead of 50, one for each brand, and then simply use conditions to show the ones that apply - I'm trying not to overload the database; it's already huge as it is...).

Please Log in to join the conversation.

More
5 years 2 months ago #68674 by Mazi
You can use an array question (see docs.limesurvey.org/Question+type+-+Arra...tions+for+LimeSurvey ) with your own, predefined scale from 1-10. As subquestions list the same answer options as used at the multiple choice question. Then use the array filter question attribute to only display the items that were ticked previously: docs.limesurvey.org/Question+type+-+Arra...eSurvey#Array_filter


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago - 5 years 2 months ago #68681 by tpartner
Yeah you could do that but you wouldn't have the sub-questions in the order that they were selected in Q1 and you couldn't have multiple rows for each Q1 selection.

So, in this case you will want to save the Q1 values (not codes) in order and then pipe them into the question text for the arrays.

1) Add a short-text to the first group (to be hidden and loaded with the Q1 answers).

2) Add the following script to the source of the short-text question. Replace "11" with the multiple-options question ID and "HH" with the short-text question ID. The script loads the hidden question with the Q1 answers in the order that they were checked.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var q1ID = 11;
		var qHidden = HH;
 
		// Hide the hidden question
		$('#question'+qHidden+'').hide();
 
		var q1Answers = new Array();
 
		// Build an array of q1 answers checked
		$('#question'+q1ID+' input.checkbox').click(function(){
			var ansText = $(this).siblings('label').text();
			if($(this).attr('checked') == true) {
				q1Answers.push(ansText);
			}
		});
 
		// Interrupt next/submit function 
		$('#movenextbtn, #movesubmitbtn').click(function(){
 
			// Load the hidden question with the Q1 answers
			$('#question'+qHidden+' input.text').val(q1Answers);
 
			return true;
		});
 
	});
</script>

3) In source of the 3 array questions, add a span element to be loaded with a Q1 answer. So the source of the question text should look something like:
Regarding the first car you have stated to own <span class="pipedText">&nbsp;</span>, in a scale from 1 to 10...

4) Add the following script to the source of one of the arrays. It will retrieve the Q1 answers (in order) and load the spans with the resulting text. Replace "11111X22X33" with the correct SGQA for the hidden question.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Retrieve the Q1 answers
		var q1Answers = '{INSERTANS:11111X22X33}';
		var q1Arr = q1Answers.split(',');
 
		// Load the piped text spans
		$(q1Arr).each(function(i, value){
			$('.pipedText:eq('+i+')').text(value);
		});
 
	});
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 2 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 2 months ago #68697 by cegreja
That's exactly it, tpartner. It worked. You're great.

It will take a while but I'll definitely donate. Thanks for all the hard work.

Please Log in to join the conversation.

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