- Posts: 8
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Creating variables (randomization/whether users have clicked on a link)
- Michael91
- Topic Author
- Offline
- New Member
Less
More
7 years 3 months ago #146769
by Michael91
Creating variables (randomization/whether users have clicked on a link) was created by Michael91
Hey; I want to create some variables problematically for two purposes:
-To define a float that I can use to randomly assign users questions with specific probabilities.
-To record whether users have clicked on a link I provide.
Presumably, these can both be accomplished with Javascript in limesurvey (let me know if that's not the case). But I'm not sure how. The first step is figuring out how to assign variables to be recorded by the survey at all. From googling, I found this topic: www.limesurvey.org/forum/can-i-do-this-w...riable-in-limesurvey
However, the code provided by tpartner doesn't seem to do anything for me (or I am using it incorrectly). When I add in that script to create the "Lines" variable as 4, and then activate the survey, that variable doesn't show up in my responses when I complete the survey. Additionally, I've added "Lines == 4" into relevance question for a later question group to see if I can use the Lines variable to show my other question, but this question group remains hidden. So I don't think "Lines" is actually be created anywhere. I must be doing something wrong, but I have no idea how to fix my issue. Can anyone help? Much appreciated. Thanks!
-To define a float that I can use to randomly assign users questions with specific probabilities.
-To record whether users have clicked on a link I provide.
Presumably, these can both be accomplished with Javascript in limesurvey (let me know if that's not the case). But I'm not sure how. The first step is figuring out how to assign variables to be recorded by the survey at all. From googling, I found this topic: www.limesurvey.org/forum/can-i-do-this-w...riable-in-limesurvey
However, the code provided by tpartner doesn't seem to do anything for me (or I am using it incorrectly). When I add in that script to create the "Lines" variable as 4, and then activate the survey, that variable doesn't show up in my responses when I complete the survey. Additionally, I've added "Lines == 4" into relevance question for a later question group to see if I can use the Lines variable to show my other question, but this question group remains hidden. So I don't think "Lines" is actually be created anywhere. I must be doing something wrong, but I have no idea how to fix my issue. Can anyone help? Much appreciated. Thanks!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago - 7 years 3 months ago #146775
by tpartner
Can you activate a test survey and give a link?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Creating variables (randomization/whether users have clicked on a link)
Do you have any JavaScript errors in the console?However, the code provided by tpartner doesn't seem to do anything for me (or I am using it incorrectly).
Can you activate a test survey and give a link?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 3 months ago by tpartner.
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146781
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
I didn't see any notifications about Javascript errors.
Here's the test link: michael91.limequery.com/515511?lang=en
Thanks!
Here's the test link: michael91.limequery.com/515511?lang=en
Thanks!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago #146785
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 Creating variables (randomization/whether users have clicked on a link)
The script is to work with a short-text question, not a list-radio type.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146786
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
Alright, thanks. I'd love to test that, but right now it seems there's no way to edit questions on an activated survey. I tried deactivating it, and I still can't edit or activate it. This seems to make it impossible to iterate on a survey where I need to test whether information is recorded properly. Am I missing something?
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146787
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
*no way to add new questions anyway.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago #146789
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 Creating variables (randomization/whether users have clicked on a link)
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146791
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
By deactivate, I meant expire. I still have the responses, but I can't add new questions or activate the survey.
It's not a big problem for this specific survey; I can recreate my work and test again. But it makes it extremely difficult to iterate. If I wanted to test a change I made to the survey and how that effected that data that was recorded, I believe I would have to activate the survey to get responses, and once I've done that, there is no way to go back and add a new question. So I'm extremely limited in the changes I can make. Is there no way to test how a survey is recording results without making it much more difficult to change that survey?
It's not a big problem for this specific survey; I can recreate my work and test again. But it makes it extremely difficult to iterate. If I wanted to test a change I made to the survey and how that effected that data that was recorded, I believe I would have to activate the survey to get responses, and once I've done that, there is no way to go back and add a new question. So I'm extremely limited in the changes I can make. Is there no way to test how a survey is recording results without making it much more difficult to change that survey?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago - 7 years 3 months ago #146793
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 Creating variables (randomization/whether users have clicked on a link)
You can only add/remove or change question types when the survey is deactivated because that affects the database columns required to store that data. So, by definition, the data sets for the two survey versions will be different.If I wanted to test a change I made to the survey and how that effected that data that was recorded, I believe I would have to activate the survey to get responses, and once I've done that, there is no way to go back and add a new question.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 3 months ago by tpartner.
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146795
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
Ah; my mistake. I had thought deactivate survey was basically a "kill this survey" option. If I can deactivate it and reactivate it, it doesn't matter that I lose the responses for iterative testing purposes. Thanks!
The topic has been locked.
- Michael91
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
7 years 3 months ago #146796
by Michael91
Replied by Michael91 on topic Creating variables (randomization/whether users have clicked on a link)
Ok, I tried your suggestion. It does allow me to set my variable. However, this appears to require me actually showing a short answer question to respondents and having it fill in the answer for them. I want this to be a hidden variable that they don't see. Is there anyway to accomplish this?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago #146799
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 Creating variables (randomization/whether users have clicked on a link)
You can hide the question with CSS or JavaScript. Searching the forums should yield many examples of how to do that.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.