- Posts: 222
- Thank you received: 10
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Prefilling default answers based on tokens for various types of question
- krosser
- Topic Author
- Offline
- Elite Member
I know that the 'Multiple short text' question allows to prefill the text fields, using the token attributes. But I would like to prefill answers for other types of questions: Radio(List), Multiple choice, Arrays...
Any advice on how to do that would be much appreciated.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10098
- Thank you received: 3589
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13597
- Thank you received: 2487
For example : Q00 : a single choice question, prefilled by a code in attribute 2
create a hidden equation question ate start of survey with
{Q00=if(is_empty(Q00.NAOK),TOKEN:ATTRIBUTE_2,Q00.NAOK)}
Else : bugs.limesurvey.org/view.php?id=14754 4.0 project
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.
- krosser
- Topic Author
- Offline
- Elite Member
- Posts: 222
- Thank you received: 10
So, I have to place a hidden equation question before the question to be prefilled.
I have tested it with a radio(list) and dropdown menu, and it works. But what to do with the multiple-choice question type?
I have found Tony's previous post from 3 years ago, but following the steps described there did not work for me.
www.limesurvey.org/de/foren/design-issue...n-information#136237
Is that method still relevant today or something has changed?
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13597
- Thank you received: 2487
{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}
and equG1 just have 1 …
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.
- krosser
- Topic Author
- Offline
- Elite Member
- Posts: 222
- Thank you received: 10
DenisChenu wrote: Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1
{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}
and equG1 just have 1 …
Thanks, but does it mean that I need to create an attribute for each answer choice/subquestion in that multiple-choice?
Also, the problem is that this method keeps prefilling that answer choice even after I deselect it, move to next page, and then come back to it - it is refilled again.
My intention is to give the respondent the ability to change his/her previous answer in that multiple choice and save a new value.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13597
- Thank you received: 2487
You need a have a way to know if ech option must be checked or not.krosser wrote: Thanks, but does it mean that I need to create an attribute for each answer choice/subquestion in that multiple-choice?
Did you read ?krosser wrote: Also, the problem is that this method keeps prefilling that answer choice even after I deselect it, move to next page, and then come back to it - it is refilled again.
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group
Then : use token + prefill value for each token using VV import : it's the method i always use …krosser wrote: My intention is to give the respondent the ability to change his/her previous answer in that multiple choice and save a new value.
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.
- krosser
- Topic Author
- Offline
- Elite Member
- Posts: 222
- Thank you received: 10
Okay, understood.You need a have a way to know if ech option must be checked or not.
Yes, but thought that everything was included in the code line. Can you please give an example of the part with reset to empty?Did you read ?
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group
Okay, I thought that token attributes would be a better way, especially when it is written in the instructions to VV that there might be errors with importing CSV back to LimeSurvey.Then : use token + prefill value for each token using VV import : it's the method i always use …
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13597
- Thank you received: 2487
support.sondages.pro/?lang=en_USkrosser wrote:
Okay, understood.You need a have a way to know if ech option must be checked or not.
Yes, but thought that everything was included in the code line. Can you please give an example of the part with reset to empty?Did you read ?
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group
I always use LibreOffice calc for vv edition : never have issue …krosser wrote:
Okay, I thought that token attributes would be a better way, especially when it is written in the instructions to VV that there might be errors with importing CSV back to LimeSurvey.Then : use token + prefill value for each token using VV import : it's the method i always use …
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.
- krosser
- Topic Author
- Offline
- Elite Member
- Posts: 222
- Thank you received: 10
Not really helpful.DenisChenu wrote: support.sondages.pro/?lang=en_US
Yeah, I use it too for CSVs. Will see how this works for complex questions.DenisChenu wrote: I always use LibreOffice calc for vv edition : never have issue …
It is just token attributes seemed easier and quicker because you do not need to analyse the structure of the exported CSV and map your question answers to codes used there. It is a lot of manual work, or writing additional scripts in R for prepopulating the CSV. You do not always have that time...
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13597
- Thank you received: 2487
really helpful if you open a ticketkrosser wrote: Not really helpful.
There are NO reset to empty : all is included inCan you please give an example of the part with reset to empty?
{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}
Andf about 2nd equation
equG1 just have 1
If you can not do with this instruction : open a professional support ticket.
If you have 5 ro 10 question to prefill : really easy to dokrosser wrote: Yeah, I use it too for CSVs. Will see how this works for complex questions.
It is just token attributes seemed easier and quicker because you do not need to analyse the structure of the exported CSV and map your question answers to codes used there. It is a lot of manual work, or writing additional scripts in R for prepopulating the CSV. You do not always have that time...
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.