Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Is it possible to pass the token in the url and store as a hidden field?

Re: Is it possible to pass the token in the url and store as a hidden field? 2 years 11 months ago #64260

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4069
  • Thank you received: 748
  • Karma: 341
My script can't be added to template.js. It needs to be added to the source of a group description or a question.

The {TOKEN} keyword placeholder won't work in template.js (nor will any keyword placeholder).
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Is it possible to pass the token in the url and store as a hidden field? 2 years 11 months ago #64262

  • dataguru
  • dataguru's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 36
  • Karma: 0
Let's see if I can make it work there.\

Thanks for your assistance.

Betty
The administrator has disabled public write access.

Re: Is it possible to pass the token in the url and store as a hidden field? 2 years 11 months ago #64263

  • dataguru
  • dataguru's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 36
  • Karma: 0
I added it to both question groups, altered it just a little and it works perfectly!
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Find the survey ID
		if($('input#fieldnames').length != 0) {
			var fieldNames = $('input#fieldnames').attr('value');
			var tmp = fieldNames.split('X');
			var sID = tmp[0];
		}
 
		// Insert a new div after the progress bar
		$('<div id="optOutLink" />').insertBefore('#progress-wrapper');
 
		// Style the new div
		$('#optOutLink').css({
			'text-align':'center'
		});
 
		// Insert opt out url in the new div
		$('#optOutLink').html('<P><a href="optout.php?lang=en&sid='+sID+'&token={TOKEN}">Click here to opt out of this survey.</a></p><br>');
 
	});
 
</script>

Thanks again for your assistance!

FYI, I think our IT department is going to start using LS as well. Now I just have to try and figure out how to get a donation made to help support this project.

Betty
The administrator has disabled public write access.

Re: Is it possible to pass the token in the url and store as a hidden field? 2 years 11 months ago #64283

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4069
  • Thank you received: 748
  • Karma: 341
You're welcome.

You may want to change <P> to <p>. IE sometimes gets confused by uppercase tags.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Is it possible to pass the token in the url and store as a hidden field? 2 years 11 months ago #64291

  • dataguru
  • dataguru's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 36
  • Karma: 0
Thanks Tony. :)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.170 seconds
Donation Image