Welcome, Guest
Username: Password: Remember me

TOPIC: Question about QUOTAS

Question about QUOTAS 3 years 7 months ago #58176

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
Hi again,
I need to put a quota in a survey. The question for the quota is the multiple
choice. For example:

Q1. In the next list check who you know (multiple choice):
1. Blair
2. Obama
3. Berlusconi
4. Zapatero
5. Merkel

Valid for quota when the person checks Obama or Zapatero. If the person checks Blair and Obama is ok, but if only checks Blair isn’t ok.

How can I do it?

Thank,
Rafael
The administrator has disabled public write access.

Re: Question about QUOTAS 3 years 7 months ago #58184

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
quotas can only be set for certain answers, you can't check if A1 AND A3 or A2 AND NOT A5 were ticked.

To validate several checkboxes you can code some additional javascript and if your conditions is met this javascript can populate a hidden question which can then be used for a quota.

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: Question about QUOTAS 3 years 7 months ago #58186

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
Thank Mazi,

Where can I find an example about this?

Rafael.
The administrator has disabled public write access.

Re: Question about QUOTAS 3 years 7 months ago #58196

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
I need to learn to do this. What will it cost?

Rafael.
The administrator has disabled public write access.

Re: Question about QUOTAS 3 years 7 months ago #58230

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4271
  • Thank you received: 806
  • Karma: 369
Here's an example of how to set a quota depending on the first two options of a multiple-options question being checked.

Set up your survey to use JavaScript.

Create a yes-no question on the same page as the multiple options question.

Add the following script to the yes-no question. Replace "11" with the ID of the multiple-options question and "22" with the ID of the yes-no question.

The script:
- hides the yes-no question
- puts a listener on the multiple-options checkboxes so that if the first two options are checked the yes-no is set to "Yes", otherwise the yes-no is set to "No".

You can then set a quota on the yes-no question.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){ 
 
		var q1ID = 11;
		var q2ID = 22;
 
		// Hide the hidden question
		$('#question'+q1ID+'').hide();
 
		// A listener on Q1 checkboxes
		$('#question'+q1ID+' input.checkbox').click(function () { 
 
			// Count the checked boxes and populate the hidden question accordingly
			if ($('#question'+q1ID+' input.checkbox:eq(0)').attr('checked') == true && $('#question'+q1ID+' input.checkbox:eq(1)').attr('checked') == true) {
				$('#question'+q2ID+' input.radio:eq(0)').attr('checked', true);
			} 
			else {
				$('#question'+q2ID+' input.radio:eq(1)').attr('checked', true);
			}
		});
	});
 
</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.
Last Edit: 3 years 7 months ago by tpartner.
The administrator has disabled public write access.

Re: Question about QUOTAS 3 years 7 months ago #58236

  • rafael_ur
  • rafael_ur's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 74
  • Karma: 0
Many thank.
I will seek ways to contribute.

Again, thank Tony.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.136 seconds
Donation Image