- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
QUOTA - Terminate if a specific answer has not been checked
- dariodallago
- Topic Author
- Offline
- New Member
Less
More
9 years 11 months ago - 9 years 11 months ago #108009
by dariodallago
QUOTA - Terminate if a specific answer has not been checked was created by dariodallago
Hi,
I'm having some trouble with QUOTA for this specific question (see image attached).
All responents have to check "product B". So I want to automatically terminate the survey if a respondent has not answered "product B".
So, if someone chooses Product B and D, they would continue the survey. If they choose only D, or only A or only C (plus a few other combinations), the survey would automatically terminate.
Can someone help me in this? :blink:
Thank you
Dario
I'm having some trouble with QUOTA for this specific question (see image attached).
All responents have to check "product B". So I want to automatically terminate the survey if a respondent has not answered "product B".
So, if someone chooses Product B and D, they would continue the survey. If they choose only D, or only A or only C (plus a few other combinations), the survey would automatically terminate.
Can someone help me in this? :blink:
Thank you
Dario
Attachments:
Last edit: 9 years 11 months ago by holch.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10102
- Thank you received: 3589
9 years 11 months ago #108025
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic QUOTA - Terminate if a specific answer has not been checked
I think you will need to use JavaScript to interrupt the "Next" function and, if "B" is not checked, click a hidden select-radio question. The quota could the be based on the hidden radio question.
.
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
9 years 11 months ago #108118
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic QUOTA - Terminate if a specific answer has not been checked
Hi Tpartner!
Thank you for the response. Dario is working with me and is trying a few things in Limesurvey at the moment.
We were wondering, if we could do all this with a simple equation. The results of an equation should be written into the database, right? Or do we still have to write the results of the equation via Javascript into a hidden question?
In this case, how would we do this?
Thank you for the response. Dario is working with me and is trying a few things in Limesurvey at the moment.
We were wondering, if we could do all this with a simple equation. The results of an equation should be written into the database, right? Or do we still have to write the results of the equation via Javascript into a hidden question?
In this case, how would we do this?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10102
- Thank you received: 3589
9 years 11 months ago #108119
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic QUOTA - Terminate if a specific answer has not been checked
Hi Holch,
I don't think an equation question will help in this case. As far as I can see, the equation is not a supported question type for quotas.
When I get a chance, I'll attach a small sample survey.
LS 2.0 or 2.05?
I don't think an equation question will help in this case. As far as I can see, the equation is not a supported question type for quotas.
When I get a chance, I'll attach a small sample survey.
LS 2.0 or 2.05?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
9 years 11 months ago #108121
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic QUOTA - Terminate if a specific answer has not been checked
At the moment LS 2.0, but I would like to move it to 2.05. Is there a difference between those two?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10102
- Thank you received: 3589
9 years 11 months ago #108122
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic QUOTA - Terminate if a specific answer has not been checked
There may be small differences in the JS - 2.05 uses a much newer version of jQuery and some stuff has been deprecated.
I'll do it up for 2.0
.
I'll do it up for 2.0
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
9 years 11 months ago #108126
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic QUOTA - Terminate if a specific answer has not been checked
I really need to freshn up my Javascript. I actually learned it, but then forgot most of it, because I did not use it much. And since then, the importance of Javascript has changed a lot. Before it was more for gimmicks (everyone looked down on it), now it really has found its place and is very important for webdevelopment.
Unfortunately there are still some things that LS (while quite good already), does not offer out of the box. Real screenouts for example. And this is a case where the workaround with the zero quotas fails misserably. But in market research, this is quite a common scenario.
Unfortunately there are still some things that LS (while quite good already), does not offer out of the box. Real screenouts for example. And this is a case where the workaround with the zero quotas fails misserably. But in market research, this is quite a common scenario.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10102
- Thank you received: 3589
9 years 11 months ago #108131
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic QUOTA - Terminate if a specific answer has not been checked
Okay, so here's a working example.
The survey consists of the product multiple-choice question, followed by a radio question with a single answer. The radio question must be place directly after the multiple-choice.
The radio question is hidden by JavaScript and toggled depending on the "checked" state of a "mandatory" option in the products question.
A quota of 0 is placed on the single answer of the radio question.
The following script is placed in the source of the multiple-choice (I think the comments in the script adequately describe what it does). In this case I defined sub-question code "b" as mandatory.
The survey consists of the product multiple-choice question, followed by a radio question with a single answer. The radio question must be place directly after the multiple-choice.
The radio question is hidden by JavaScript and toggled depending on the "checked" state of a "mandatory" option in the products question.
A quota of 0 is placed on the single answer of the radio question.
The following script is placed in the source of the multiple-choice (I think the comments in the script adequately describe what it does). In this case I defined sub-question code "b" as mandatory.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var qID = {QID}; var thisQuestion = $('#question'+qID); var quotaQuestion = $(thisQuestion).nextAll('.list-radio:eq(0)'); // The sub-question code of the mandatory option var mandatoryOptionCode = 'b'; // Hide the quota question $(quotaQuestion).hide(); // Interrupt the Next/Submit function $('form#limesurvey').submit(function(){ // Is the mandatory option checked? if($('input.checkbox[id$="X'+qID+mandatoryOptionCode+'"]').is(':checked') == false) { // No, so click the quota radio $('input.radio', quotaQuestion).click(); } else { // Yes, so uncheck the quota radio $('input.radio', quotaQuestion).attr('checked', false); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: dariodallago
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
9 years 11 months ago #108135
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic QUOTA - Terminate if a specific answer has not been checked
Hi Tony!
Many thanks for this. I'll have a look at it later today and then adapt it to our survey.
Many thanks for this. I'll have a look at it later today and then adapt it to our survey.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- dariodallago
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
9 years 11 months ago #108194
by dariodallago
Replied by dariodallago on topic QUOTA - Terminate if a specific answer has not been checked
IT WORKS!
I'll make sure to addapt all things correctly, but most of the work is now done.
Thank you a lot for this, tpartner!
"Sorry, we don't care what you think - get lost!"
:lol:
I'll make sure to addapt all things correctly, but most of the work is now done.
Thank you a lot for this, tpartner!
"Sorry, we don't care what you think - get lost!"
:lol:
The topic has been locked.