- Posts: 17
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
recording order of group randomization
- ligiasilva
- Topic Author
- Offline
- New Member
Less
More
1 year 2 months ago #239893
by ligiasilva
recording order of group randomization was created by ligiasilva
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.27.34+220132
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hello!
I have several groups in random order, and would like to store the order in which they were presented. Using suggestions from similar questions I'm thinking about including a hidden question in each group and making it store the current date.
I tried using this code:
(edited by me from a previous code where some button clicks would store dates, already given to me by Joffm here. I'm not actually a programmer...) <body onload="dateevent1()"></body><script type="text/javascript" charset="utf-8">function dateevent1(){ var thisQuestion = $('#question{QID}'); var date1 = Date.now(); $('input[type=text]:eq(0)', thisQuestion).val(date1);}</script><style type="text/css">#question{QID} .answer-container { display: none;}</style>
I thought this would work but actually it is storing as an answer only the portion of text that is inside the style tag. And once I record the question, when I come back to check it the whole script portion disappears and only the style portion remains. Tried setting this question as an equation and as multiple short texts but it didn't work on either. Any help on how I can do this?
Thank you a lot
Your LimeSurvey version: Version 3.27.34+220132
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hello!
I have several groups in random order, and would like to store the order in which they were presented. Using suggestions from similar questions I'm thinking about including a hidden question in each group and making it store the current date.
I tried using this code:
(edited by me from a previous code where some button clicks would store dates, already given to me by Joffm here. I'm not actually a programmer...) <body onload="dateevent1()"></body><script type="text/javascript" charset="utf-8">function dateevent1(){ var thisQuestion = $('#question{QID}'); var date1 = Date.now(); $('input[type=text]:eq(0)', thisQuestion).val(date1);}</script><style type="text/css">#question{QID} .answer-container { display: none;}</style>
I thought this would work but actually it is storing as an answer only the portion of text that is inside the style tag. And once I record the question, when I come back to check it the whole script portion disappears and only the style portion remains. Tried setting this question as an equation and as multiple short texts but it didn't work on either. Any help on how I can do this?
Thank you a lot
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
1 year 2 months ago #239896
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 recording order of group randomization
You can't use the body tag within another body tag, which would happen if you include this into a question. However, there is a function that allows to write the order of a group/question into a hidden question. Not quite sure what is was now, but I would have a look in the forum, there are for sure explanations on how to to this.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
1 year 2 months ago #239897
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic recording order of group randomization
Use the property ".gseq" that gives you the order.
An easy eay to save it is to use the function "list()".
Like
list(G1Q1.gseq,G2Q1.gseq,G3Q1.gseq,...)
where G1Q1 shall be the question code of a question in group1, G2Q1 the code of s question in group 2,...
Joffm
An easy eay to save it is to use the function "list()".
Like
list(G1Q1.gseq,G2Q1.gseq,G3Q1.gseq,...)
where G1Q1 shall be the question code of a question in group1, G2Q1 the code of s question in group 2,...
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: ligiasilva
Please Log in to join the conversation.
- ligiasilva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
1 year 2 months ago #239898
by ligiasilva
Replied by ligiasilva on topic recording order of group randomization
Thanks!
Didn't think that the body tag wouldn't work. Makes sense as anything I write will be assumed as part of the body anyway. I'm experimenting with Joffm's solution.
Didn't think that the body tag wouldn't work. Makes sense as anything I write will be assumed as part of the body anyway. I'm experimenting with Joffm's solution.
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
1 year 2 months ago #239899
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 recording order of group randomization
Exactly, there is already a body tag and the second body tag will have no effect or just cause problems. In HTML each document can only have one Body tag.
Joffm's solution is the way to go and was what I was referring to.
Joffm's solution is the way to go and was what I was referring to.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: ligiasilva
Please Log in to join the conversation.
- ligiasilva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
1 year 2 months ago #239900
by ligiasilva
Replied by ligiasilva on topic recording order of group randomization
Thank you Joffm,
I understand the logic, but I don't know how to execute it. I put 2 questions in a group. The first one (called grouptimePm3ton120) was still testing the idea of storing the date event (without the body tag)
"
<script type="text/javascript" charset="utf-8">
$(document).ready(dateevent1());
function dateevent1(){
var thisQuestion = $('#question{QID}');
var date1 = Date.now();
$('input[type=text]:eq(0)', thisQuestion).val(date1);
}
</script>
<style type="text/css">#question{QID} .answer-container {
display: none;
}
</style>
"
The second one has:
"
The order was:
{(grouptimePm3ton120_SQ001)} milliseconds.
list(prospM3Ton120.gseq,prosp.M3Ton90.gseq,prospM3NT120.qseq)
"
I thought this would either show the result of the previous question (1st sentence) or work through your solution (2nd sentence has codes from 3 questions belonging to 3 different groups).
Is this where I should put your solution? Does it have to do with different question types?
I'm attaching my whole survey. This work in progress is in group "prospectiveM3Ton120", all groups called prospective, prosp or attention check are randomized, and that's the order I'd like to register somehow.
Thanks a lot, You've already helped me previously, and have been very useful. Sorry for bothering again.
I understand the logic, but I don't know how to execute it. I put 2 questions in a group. The first one (called grouptimePm3ton120) was still testing the idea of storing the date event (without the body tag)
"
<script type="text/javascript" charset="utf-8">
$(document).ready(dateevent1());
function dateevent1(){
var thisQuestion = $('#question{QID}');
var date1 = Date.now();
$('input[type=text]:eq(0)', thisQuestion).val(date1);
}
</script>
<style type="text/css">#question{QID} .answer-container {
display: none;
}
</style>
"
The second one has:
"
The order was:
{(grouptimePm3ton120_SQ001)} milliseconds.
list(prospM3Ton120.gseq,prosp.M3Ton90.gseq,prospM3NT120.qseq)
"
I thought this would either show the result of the previous question (1st sentence) or work through your solution (2nd sentence has codes from 3 questions belonging to 3 different groups).
Is this where I should put your solution? Does it have to do with different question types?
I'm attaching my whole survey. This work in progress is in group "prospectiveM3Ton120", all groups called prospective, prosp or attention check are randomized, and that's the order I'd like to register somehow.
Thanks a lot, You've already helped me previously, and have been very useful. Sorry for bothering again.
Please Log in to join the conversation.
- ligiasilva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
1 year 2 months ago #239901
by ligiasilva
Replied by ligiasilva on topic recording order of group randomization
here it is.
Attachments:
Please Log in to join the conversation.
- ligiasilva
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
1 year 2 months ago #239903
by ligiasilva
Replied by ligiasilva on topic recording order of group randomization
Don't worry, got it already. Found a way to use your solution here in the forum. A simple {self.qseq} in the equation box already stored the order. Then I can even use the order number associated with each answer to analyze in terms of order, which work even better than a list with the orders in my case.
Thanks again!
Thanks again!
Please Log in to join the conversation.