Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Questions based on random selection from a multiple choice

Questions based on random selection from a multiple choice 2 years 11 months ago #69116

  • uxexp
  • uxexp's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Hello,
Here's what I am trying to do:

Q: Please select which fruits you like a)Apple b)Orange c)Kiwi d)Grapes

If the participant selects Apple, Kiwi, and Orange, I would like to randomly select only 2 of the fruits selected and then ask the following questions:

Q: Why do you like "randomly selected fruit 1"
Q: Why do you like "randomly selected fruit 2"

I spent half of my weekend trying to modify some of the workarounds to satisfy my need but was not successful. Can any of the experts help?

Thanks a ton.
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69130

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
This is a really strange requirement. The only solution i can think of would be based on some javscript which is called on submit, counts the number of checked items and then randomly unchecks X of them until only 2 are left.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69134

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6429
  • Thank you received: 839
  • Karma: 249
Hello,

Maybe something like this:

1st question: multi choice
2nd question: array / filter by first question and hide the 3RD, 4TH .... line

OUPS .... no good script : have to test with each line if it's showing or nit:

A bad xcript, need a lot of modification (INSERTANS, answers, java etc ...) , but it work
<script>
$(document).ready(function(){
if('{INSERTANS:62997X153X2161SQ001}'!='POMME'){
$('#javatbd62997X153X2166SQ001').hide();
}
if('{INSERTANS:62997X153X2161SQ002}'!='BANANE'){
$('#javatbd62997X153X2166SQ002').hide();
}
if('{INSERTANS:62997X153X2161SQ003}'!='POIRE'){
$('#javatbd62997X153X2166SQ003').hide();
}
if('{INSERTANS:62997X153X2161SQ004}'!='FRAISE'){
$('#javatbd62997X153X2166SQ004').hide();
}
$("#question2166 table.question tbody:visible:eq(2)").hide();
$("#question2166 table.question tbody:visible:eq(2)").hide();
});
</script>

Denis
Last Edit: 2 years 11 months ago by DenisChenu. Reason: Working script
The administrator has disabled public write access.
The following user(s) said Thank You: uxexp

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69137

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4263
  • Thank you received: 801
  • Karma: 367
Are all questions on the same page or separate pages? Can you attach or activate a small sample survey?
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.
Last Edit: 2 years 11 months ago by tpartner.
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69164

  • uxexp
  • uxexp's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
What I am trying to do is to not have all the participants complete all the questions for all the items they have selected. I want to limit questions to 2 of the randomly selected items. Which also means that, if they selected only one item in the list, they will only get to answer questions for the one and only selected item.


I put a demo survey together here: coolsurvey.limequery.com/47347/lang-en

Actually, there is a workaround that comes very close to what I am trying to achieve (see this link): docs.limesurvey.org/Workarounds%3A+Manip...estion_for_later_use

Except, the above workaround is restricted to one item from the multiple choice selection and I want to modify this to include 2 (or a variable number of items) items where the number of items selected for follow-up questions cannot be greater than the number of items selected from multiple choice question. In other words, the participant will be asked follow-up questions on a maximum of 2 random items from an array of items they selected on page 1 but they can never be asked more questions than the number of items they selected (e.g. if they selected 1 item, only one follow-up question will be asked).

Hope this is clear enough for you all to respond. Appreciate your help.
Last Edit: 2 years 11 months ago by uxexp.
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69165

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6429
  • Thank you received: 839
  • Karma: 249
I put an possible workaround with my script.

demonstration.sondages.pro/62997/lang-fr

It's quick & dirty, lika i already say :)
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69168

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4263
  • Thank you received: 801
  • Karma: 367
Here's what I would do.

1) In group 2 ("Why"), add a question for every possible answer from Q1.

2) Make each question in group 2 conditional on it's corresponding answer in Q1 (only shown if selected in Q1).

3) Use advanced settings to randomize the questions in group 2.

4) Add a script to Group 2 to hide all visible questions (those not already hidden by conditions) except the first two (or as many as you dictate).

This is untested but should work:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		showOnly(2); // Modify for number of questions to show.
 
		function showOnly(shownNum) {
			$('div[id^="question"]:visible').each(function(i) {
				if(i >= shownNum) { 
					$(this).hide();
			}); 
		}
 
	});
</script>
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: Questions based on random selection from a multiple choice 2 years 11 months ago #69171

  • uxexp
  • uxexp's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
OK, got it working until step 3. Except, the script is not hiding any of the questions (all questions are visible). I placed the script in the description of group 2 (hope this is right).
Thanks!
The administrator has disabled public write access.

Re: Questions based on random selection from a multiple choice 2 years 11 months ago #69172

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4263
  • Thank you received: 801
  • Karma: 367
Can you attach an export of the survey for me to test?
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: Questions based on random selection from a multiple choice 2 years 11 months ago #69173

  • uxexp
  • uxexp's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 19
  • Karma: 0
Here is the attachment. Thanks for looking into this.
Attachments:
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.136 seconds
Donation Image