Check out the LimeSurvey source code on GitHub!

Change text of survey based on token link (person taking it)

More
5 years 8 months ago #62040 by bwoo5
I am creating a 10 question survey that will be sent to 150 people by email. They will be rating 65 different people.

I need for the survey to say "You are rating {person}" based on who clicks the link.
If person 1 is rating 3 different people, they are sent 3 different links to the same survey. So when they click on each of the links, they need to see the same survey but the name of the person will change based on the link.

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #62071 by greg_d
You can use token attributes to insert the name of the person rated into the survey questions. When creating question you can put {TOKEN:ATTRIBUTE_1} in the question text - when displaying to the user it will be replaced with a value from the token.

More details you will find here: docs.limesurvey.org/tiki-index.php?page=...on_from_tokens_table

You also would probably like to save this token attribute into the response table (otherwise you will loose the information what name was displayed on the survey). To do this you have to create another question which will be automatically filled in and then hidden to the user:
1. Turn off XSS filter: docs.limesurvey.org/tiki-index.php?page=...+LimeSurvey#Security
2. Create question (short text) in which you will save information about rated person. In the Question text editor in document source mode put the following code:
{TOKEN:ATTRIBUTE_1}
<script> 
jQuery(document).ready(function() {
	document.getElementById("answer78575X62X658").value = "{TOKEN:ATTRIBUTE_1}";
	document.getElementById("question658").style.display= "none";
});
</script>
replacing answer78575X62X658 and question658 with IDs of your survey, group and question.
Last Edit: 5 years 8 months ago by greg_d.

Please Log in to join the conversation.

More
5 years 8 months ago #62084 by Ben_V
Just a question...for Greg

Could it be possible with a similar method to recuperate assessment values (into the ddbb), using {assessment_CURRENT_TOTAL} instead token-attributes placeholders ?

Excuse-me if for beeing aside with the original topic....
Thanks
Ben

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
5 years 8 months ago #62086 by greg_d

recuperate assessment values (into the ddbb)

You would like to set the answer of some question to {assessment_CURRENT_TOTAL}, then hide it and then write it to the DB as a normal response? (Just repeating your question, because I don't know if I understand you correctly).

I've never tried, but it should work. I don't think that {assessment_CURRENT_TOTAL} placeholder is handled in a different way than {TOKEN:ATTRIBUTE_1}.

Be aware that some percent (rather small) of users have Javascript disabled. Then all the workarounds with JS just don't work.

Please Log in to join the conversation.

More
5 years 8 months ago #62090 by Ben_V
Yes Greg,
That's what I mean...
So I'll try it very soon and give some feedback...It could be very helpful because until now I've to export results to EXCEL and sum the columns...!!!

Thank a lot for you answer..
Ben

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #62108 by Ben_V
GENIAL !

Yes it works to populating automatically the DB with assessment values !

Thank you a lot you because it will help me so much ! :woohoo:
Score: {assessment_CURRENT_TOTAL}
<script> 
jQuery(document).ready(function() {
	document.getElementById("answer1234X56X789").value = "{assessment_CURRENT_TOTAL}";
	document.getElementById("question789").style.display= "none";
});
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 5 years 8 months ago by Ben_V.

Please Log in to join the conversation.

More
5 years 8 months ago #62122 by TMSWhite
All-

We're working on a generic, non-JavaScript-dependent, solution to issues like the one you've described. Please comment on this thread if there is functionality we've missed.

We've added the ability to reference variables by the question.title (for those who might find the SGQA codes hard to follow).
We've also created an alternate way to compute summary scores from multiple values (e.g. to compute conditional sums, standard deviations, etc.)

Sounds like there is a similar need to "name" the tokens so that you don't have to remember what TOKEN:ATTRIBUTE_1 means or worry that its meaning might change if questions are re-ordered.

/Tom

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form