Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Pre-populating answers with custom token attributes

More
10 years 10 months ago - 10 years 10 months ago #113304 by tpartner
You need to put the expression into a hidden equation type question that follows categorie.

Question type - single-choice-radio
Question code - categorie
Question text - Hello, this is my question ... ?
Answers - Catégorie 1 (code CAT1), Catégorie 2 (code CAT2), Catégorie 3 (code CAT3)

Question type - equation
Question code - catControl
"Always hide this question" - yes
Question text - {categorie = if(categorie == "", TOKEN:ATTRIBUTE_1, categorie)}

.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 10 months ago by tpartner.
The topic has been locked.
More
7 years 6 months ago #163353 by abudzarr
I have got a similar problem, and I have tried to follow the recommendation suggested here.

Linked below is the script I have entered

snag.gy/hiI2HD.jpg

I would expect that the short-text answer would be auto-filled with token attributes

but I failed to get the expected result. snag.gy/5anUIN.jpg

Will appreciate if someone can point out where did I go wrong.

Thanks
The topic has been locked.
More
7 years 6 months ago - 7 years 6 months ago #163359 by tpartner
The script should be:

Code:
<script>
   $(document).ready(function() 
   {
      $("#question{QID} input.text").val('{TOKEN:EMAIL}');
   });
</script>

You could also do it by placing a hidden (via CSS class) equation question directly after R01 with this equation:

Code:
{R01 = (is_empty(R01), TOKEN:EMAIL, R01)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 6 months ago by tpartner.
The following user(s) said Thank You: jpperrein, abudzarr
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose