- Posts: 10
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can I do quota management on Tokens fields?
- amoswagon
-
Topic Author
- Offline
- New Member
-
Less
More
11 years 5 months ago #87703
by amoswagon
Can I do quota management on Tokens fields? was created by amoswagon
Can I do quota management on Tokens fields?
I want to pre-load Gender info (Male/ Female) into the tokens list.
Can I activate the quota management based on who showed up? for example I want only 50 female?
I know I can set 'show' conditions based on Tokens fields, but I couldn't find a way to limit quotas using them.
Thanks!
I want to pre-load Gender info (Male/ Female) into the tokens list.
Can I activate the quota management based on who showed up? for example I want only 50 female?
I know I can set 'show' conditions based on Tokens fields, but I couldn't find a way to limit quotas using them.
Thanks!
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13648
- Thank you received: 2491
11 years 5 months ago #87728
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Can I do quota management on Tokens fields?
Hello,
To use quota, you have to put the answer in a "Single choice question" . You can use some javascript to do this.
For example, put M/F in your attribute, Question code : GENDER, SUB QUestion code : M/F, question type: List radio
And in question HTML source (with xss filtering to no)
Denis
To use quota, you have to put the answer in a "Single choice question" . You can use some javascript to do this.
For example, put M/F in your attribute, Question code : GENDER, SUB QUestion code : M/F, question type: List radio
And in question HTML source (with xss filtering to no)
Code:
<script> $(function() { $("question{QID} input.radio[value='{TOKEN:ATTRIBUTE_1']").click(); }); </script>
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- amoswagon
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
11 years 5 months ago #87737
by amoswagon
Replied by amoswagon on topic Can I do quota management on Tokens fields?
This is very helpful but I'm new to it, I need more details with your example.
In Tokens table:
- added attribute called 'male-female' with 'M' and 'F' values (for male and female)
In the Survey:
- added a single choice question (radio list)
- question coded in 'GENDER'
- 2 answer choices: 'M'(code) 'Male' (label), 'F' (code) 'Female' (label)
- added your javascript to the source of the question text
- replaced '{QID}' with 'GENDER'
- replaced 'ATTRIBUTE_1' with 'male-female"
What am I doing wrong?
Thanks!
Amos
In Tokens table:
- added attribute called 'male-female' with 'M' and 'F' values (for male and female)
In the Survey:
- added a single choice question (radio list)
- question coded in 'GENDER'
- 2 answer choices: 'M'(code) 'Male' (label), 'F' (code) 'Female' (label)
- added your javascript to the source of the question text
- replaced '{QID}' with 'GENDER'
- replaced 'ATTRIBUTE_1' with 'male-female"
What am I doing wrong?
Thanks!
Amos
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13648
- Thank you received: 2491
11 years 5 months ago #87744
by DenisChenu
![:) :)](/media/kunena/emoticons/1.png)
Limesurvey replace itself {QID} by question number and {TOKEN:ATTRIBUTE_1} by the value of the token attribute.
See : docs.limesurvey.org/tiki-index.php?page=...stion_default_value_
Default value work for text question type, not for single choic question but .val("{TOKEN:ATTRIBUTE_1}") jquery work (for select qestion type, sure).
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Can I do quota management on Tokens fields?
Replacingamoswagon wrote: - replaced '{QID}' with 'GENDER'
- replaced 'ATTRIBUTE_1' with 'male-female"
What am I doing wrong?
![:) :)](/media/kunena/emoticons/1.png)
Limesurvey replace itself {QID} by question number and {TOKEN:ATTRIBUTE_1} by the value of the token attribute.
See : docs.limesurvey.org/tiki-index.php?page=...stion_default_value_
Default value work for text question type, not for single choic question but .val("{TOKEN:ATTRIBUTE_1}") jquery work (for select qestion type, sure).
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- amoswagon
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
11 years 5 months ago #87757
by amoswagon
Replied by amoswagon on topic Can I do quota management on Tokens fields?
I get it now. Thank you :blush:
I managed to do it with Text type, but still it doesn't work with single.
<script>
$(function() {
$("question{QID} input.radio[value='{TOKEN:ATTRIBUTE_1']").click();
});
</script>
Do you have a syntax error? I think one '}' is missing after 'ATTRIBUTE_1'.
I'll try to figure it out by myself.
Thanks again.
Amos
I managed to do it with Text type, but still it doesn't work with single.
<script>
$(function() {
$("question{QID} input.radio[value='{TOKEN:ATTRIBUTE_1']").click();
});
</script>
Do you have a syntax error? I think one '}' is missing after 'ATTRIBUTE_1'.
I'll try to figure it out by myself.
Thanks again.
Amos
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13648
- Thank you received: 2491
11 years 5 months ago #87777
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Can I do quota management on Tokens fields?
You're right, and lost some # too.amoswagon wrote: Do you have a syntax error? I think one '}' is missing after 'ATTRIBUTE_1'.
I'll try to figure it out by myself.
Code:
$(function() { $("#question{QID} input.radio[value='{TOKEN:ATTRIBUTE_1}']").click(); });
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- amoswagon
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
11 years 5 months ago #87807
by amoswagon
Replied by amoswagon on topic Can I do quota management on Tokens fields?
It's working! Could you believe?! :ohmy:
Thank you!
Amos
Thank you!
Amos
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13648
- Thank you received: 2491
11 years 5 months ago #87838
by DenisChenu
but if you don't have token table and token attribute_1, javascript is breaked.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Can I do quota management on Tokens fields?
Yesamoswagon wrote: It's working! Could you believe?! :ohmy:
![:P :P](/media/kunena/emoticons/15.png)
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- amoswagon
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
11 years 4 months ago #89907
by amoswagon
Replied by amoswagon on topic Can I do quota management on Tokens fields?
Hi.
Since I upgraded to 2.00+ the javascript you gave me does not work!?
Very frustrating!
Any ideas?
Amos
Since I upgraded to 2.00+ the javascript you gave me does not work!?
Very frustrating!
Any ideas?
Amos
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10109
- Thank you received: 3595
11 years 4 months ago #89918
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 Can I do quota management on Tokens fields?
Have you upgraded to the latest version? There was a problem with {QID} in 2.0 but it has been fixed recently.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.