Redirect/change expired-inactive survey message

More
5 months 2 weeks ago #153503 by FaLifeTime
FaLifeTime created the topic: Redirect/change expired-inactive survey message
Hi: i need some help. I’m trying to change either the expired survey message or the deactivated survey message. I created one enrollment survey per course in the institution where I work and I want to show users another message if they try to access any survey link while is closed or expired; something like “The enrollment survey is closed, please check out …”. It could be a better solution also to redirect to a specific Scholl web page section giving a special message or some choices.

I read this thread without success.

Thanks,

4aLifeTime[/color][/color]

Please Log in to join the conversation.

More
5 months 2 weeks ago #153516 by tpartner
tpartner replied the topic: Redirect/change expired-inactive survey message
You have linked to another (old) thread but not explained what you have tried and how it failed. Also what is your LimeSurvey version?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: FaLifeTime

Please Log in to join the conversation.

More
5 months 2 weeks ago #153524 by FaLifeTime
FaLifeTime replied the topic: Redirect/change expired-inactive survey message
Hi tpartner,

thanks for your quick reply. Im using "Versión 2.05+ Build 150520". Concerning the thread i particularly tried your suggestion (below) adapting the messages into my default language: Spanish. It didnt work out, but i insist, my code knowledge is limited. Do i have any chance to redirect users if surveys are inactivated or expired?

Thanks!
4aLifeTime

$(document).ready(function() {

if($('p#tokenmessage').length > 0 && $('#tokenform').length == 0) {
var stringIndex = $('p#tokenmessage').text().indexOf('Diese Umfrage ist beendet und steht nicht mehr zur Verfügung);
if(stringIndex >= 0) {
$('p#tokenmessage').html('This survey is CLOSED!<br /><br />Go away!');
}
}

});

Please Log in to join the conversation.

More
5 months 2 weeks ago #153529 by tpartner
tpartner replied the topic: Redirect/change expired-inactive survey message
I see a bug (a missing closing quote) in that code so it should be:
$(document).ready(function() {
	if($('p#tokenmessage').length > 0 && $('#tokenform').length == 0) {
		var stringIndex = $('p#tokenmessage').text().indexOf('Diese Umfrage ist beendet und steht nicht mehr zur Verfügung');
		if(stringIndex >= 0) {
			$('p#tokenmessage').html('This survey is CLOSED!<br /><br />Go away!');
		}
	}
});

However, if using Spanish, you will need to replace the German string with whatever you see in Spanish. Probably this:
$(document).ready(function() {
	if($('p#tokenmessage').length > 0 && $('#tokenform').length == 0) {
		var stringIndex = $('p#tokenmessage').text().indexOf('Esta encuesta ya no está disponible');
		if(stringIndex >= 0) {
			$('p#tokenmessage').html('This survey is CLOSED!<br /><br />Go away!');
		}
	}
});

Having said that, if you want to redirect when the survey is closed instead of showing a custom message, try something like this (for Spanish):
$(document).ready(function() {
	if($('p#tokenmessage').length > 0 && $('#tokenform').length == 0) {
		var stringIndex = $('p#tokenmessage').text().indexOf('Esta encuesta ya no está disponible');
		if(stringIndex >= 0) {
			window.location = "http://google.com";
			$('p#tokenmessage').html('This survey is CLOSED!<br /><br />You are being redirected to our website.');
		}
	}
});

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

Please Log in to join the conversation.

More
5 months 2 weeks ago #153530 by FaLifeTime
FaLifeTime replied the topic: Redirect/change expired-inactive survey message
Thanks tpartner. It works perfectly!

Cheers,
4aLifeTime

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now