Check out the LimeSurvey source code on GitHub!

Question about QUOTAS

More
5 years 10 months ago #58176 by rafael_ur
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

Please Log in to join the conversation.

More
5 years 10 months ago #58184 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 10 months ago #58186 by rafael_ur
Thank Mazi,

Where can I find an example about this?

Rafael.

Please Log in to join the conversation.

More
5 years 10 months ago #58196 by rafael_ur
I need to learn to do this. What will it cost?

Rafael.

Please Log in to join the conversation.

More
5 years 10 months ago - 5 years 10 months ago #58230 by tpartner
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.
Last Edit: 5 years 10 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 10 months ago #58236 by rafael_ur
Many thank.
I will seek ways to contribute.

Again, thank Tony.

Please Log in to join the conversation.

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