Mazi, my Javascript isn't really up to a good demonstration to solve this very particular and unusual need. It would be more useful IMHO to elaborate the principle in the
tokens section of the manual a little, eg.
If your survey is NOT anonymous, the following field names are a
vailable to insert token data in survey text and Javascript:
[table of fieldnames here]
For example, if Attribute 1 contains either 'worker' or 'boss', one could personalise a question:
Hello {TOKEN:FIRSTNAME}, what do you as a {TOKEN:ATTRIBUTE_1} think about your [script]if {TOKEN:ATTRIBUTE_1}='worker' then write 'bosses' else write 'workers'[/script]?
In an anonymous survey these field names are not available because the tokens table is dissociated from the survey. (Changes in bold.)
If this is a useful explanation how one might use these fieldnames, then people can come up with all sorts of creative ways to exploit them. What do you think? Feel free to improve ...
Regards.