Welcome, Guest
Username: Password: Remember me

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

Change text of survey based on token link (person taking it) 3 years 2 months ago #62040

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62071

  • greg_d
  • greg_d's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 47
  • Thank you received: 7
  • Karma: 4
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: 3 years 2 months ago by greg_d.
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62084

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1067
  • Thank you received: 235
  • Karma: 74
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62086

  • greg_d
  • greg_d's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 47
  • Thank you received: 7
  • Karma: 4
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.
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62090

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1067
  • Thank you received: 235
  • Karma: 74
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62108

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1067
  • Thank you received: 235
  • Karma: 74
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 3 years 2 months ago by Ben_V.
The administrator has disabled public write access.

Re: Change text of survey based on token link (person taking it) 3 years 2 months ago #62122

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.243 seconds
Donation Image