Hi everyone - fairly new to LimeSurvey - we are using Version 2.50+ Build 160426.
We have a survey that our members must fill in every year. What I'd like to do is prepopulate some of the fields with the answers that were given last year. I have last year's answers as fields (attributes) in the token table. Now what I want to do is use them to prepopulate fields in the survey.
One question is an array (texts), that has a number of subquestions. The X Scale has a total subquestion, and this is the one I want to prepopulate with last year's answers.
I also want to do the same thing, only this time with a multiple choice question. I see there is an "Edit Default Answers" button, but that isn't much help.
I read the documentation, and thought maybe creating a hidden question/group at the beginning of the survey would accomplish it, but I guess my coding skills are not there yet. Im not even sure if its necessary to use Javascript.
I guess the better way to describe it is Im looking to set a default answer to a token field, in the question types I mentioned.
This survey is an annual one - Id like to populate these questions with what they answered last year, but give them the option to override the default to put in a new answer.
Setting default values for a multiple-choice depending on token values is a little trickier because you have to check whether the group has been previously visited.
Assuming the the multiple-choice has question code "Q2" and sub-question codes "SQ1, SQ2, SQ3...":
Place a short text question (code qHidden1) directly after the multiple-choice and use the "Always hide this question" setting. We'll use Expression Manager to set this as an indicator if the page has been previously visited.
Place an equation question (code equation2) directly after qHidden1 with something like this as a value:
Code:
{Q2_SQ2 =(if(is_empty(qHidden1) AND TOKEN:ATTRIBUTE_1 =='Some value','Y', Q2_SQ2))}
Place an equation question directly after equation2 with this as a value:
Code:
{qHidden1 =1}
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.