Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Access answer in Assessment Result Message

Access answer in Assessment Result Message 5 years 9 months ago #56872

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6573
  • Thank you received: 1477
  • Karma: 579
You could store them in the same cookie but I think that would over-complicate things. If you only want to show the message if both questions are "Yes", I would check them before storing the cookie and then set the cookie to "Show" or "Hide".

So your script for the last page would be something like:
<script type="text/javascript" charset="utf-8">
		// Find the question results
		var result1 = '{INSERTANS:11111X22X33}';
		var result2 = '{INSERTANS:11111X22X34}';
		// Set a cookie with the Show/Hide value
		if(result1 == "Yes" && result2 == "Yes") {
			document.cookie = 'showMsg=Show';	
		else {
			document.cookie = 'showMsg=Hide';

And in the end message:
<script type="text/javascript" charset="utf-8">
		// A function to get the value of a cookie by name
		function getCookie (cookieName) {
			var results = document.cookie.match ('(^|;) ?' + cookieName + '=([^;]*)(;|$)');
			if (results) {
				return (unescape (results[2]));
			else {
				return null;
		// Hide the dynamic message
		// Retrieve the cookie value
		var showMsg = getCookie ('showMsg');
		// Display the message if the cookie is "Show"
		if(showMsg == 'Show') {
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
Time to create page: 0.440 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form