Redirect/change expired-inactive survey message

Mehr
1 Jahr 5 Monate her #153503 von FaLifeTime
FaLifeTime erstellte das Thema 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]

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 5 Monate her #153516 von tpartner
tpartner antwortete auf das Thema: 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.
Folgende Benutzer bedankten sich: FaLifeTime

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 5 Monate her #153524 von FaLifeTime
FaLifeTime antwortete auf das Thema: 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!');
}
}

});

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 5 Monate her #153529 von tpartner
tpartner antwortete auf das Thema: 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.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 5 Monate her #153530 von FaLifeTime
FaLifeTime antwortete auf das Thema: Redirect/change expired-inactive survey message
Thanks tpartner. It works perfectly!

Cheers,
4aLifeTime

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her - 4 Monate 1 Woche her #169542 von SCHEP23
SCHEP23 antwortete auf das Thema: Redirect/change expired-inactive survey message
Hi this workaround works also in version 3? Where I have to put the instruction?

Thanks
Laura
Letzte Änderung: 4 Monate 1 Woche her von SCHEP23.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her #169570 von tpartner
tpartner antwortete auf das Thema: Redirect/change expired-inactive survey message
The code would be placed in custom.js.

Which workaround? There are two given above.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: SCHEP23

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her #169575 von SCHEP23
SCHEP23 antwortete auf das Thema: Redirect/change expired-inactive survey message
I copy-paste the following in the custom.js of my theme:

$(document).ready(function() {
if($('p#tokenmessage').length > 0 && $('#tokenform').length === 0) {
var stringIndex = $('p#tokenmessage').text().indexOf('We are sorry but the survey is expired and no longer available');
if(stringIndex >= 0) {
window.location = " google.com ";
$('p#tokenmessage').html('This survey is CLOSED!<br /><br />You are being redirected to our website.');
}
}
});

And nothing happened in error message. I'm using english and Limesurvey 3.7.2.

Thanks a lot for any suggestion
Laura

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her #169630 von tpartner
tpartner antwortete auf das Thema: Redirect/change expired-inactive survey message
Place something like this is custom.js:

$(document).on('ready pjax:scriptcomplete',function(){
 
	var lsText = 'We are sorry but the survey is expired and no longer available.';
	var newText = 'This survey is CLOSED!<br /><br />You are being redirected to our website.';
 
	if($('p.message-0').length == 1 && $('p.message-0:first').text() == lsText) {			
		$('p.message-0:first').text(newText);
		window.location = "http://google.com";
	}
});

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 6 Tage her - 4 Monate 6 Tage her #169695 von SCHEP23
SCHEP23 antwortete auf das Thema: Redirect/change expired-inactive survey message
Thanks, i paste this script in theme custom.js but nothing happened.
It's the right place?
Laura
Letzte Änderung: 4 Monate 6 Tage her von SCHEP23.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 6 Tage her #169700 von tpartner
tpartner antwortete auf das Thema: Redirect/change expired-inactive survey message
Can you activate a test survey and give a link here?

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 6 Tage her #169723 von SCHEP23
SCHEP23 antwortete auf das Thema: Redirect/change expired-inactive survey message
Sorry, i cannot do that.
I'm not sure I putted the script in the right form: i did the following:
Configuration-->Advanced-->Themes
I choose the extended one i'm using for the survey and select Theme editor. Than I copied-pasted the script you provide me in the custom.js.
As I said before my expire message is always the same..
Hope this clarify a little
Thanks Laura

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 6 Tage her #169725 von tpartner
tpartner antwortete auf das Thema: Redirect/change expired-inactive survey message
It may be a caching issue. Completely clear you cache before testing.

Try placing this simple alert in custom.js:

$(document).on('ready pjax:scriptcomplete',function(){
	alert('Page loaded.');
});

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 5 Tage her #169760 von SCHEP23
SCHEP23 antwortete auf das Thema: Redirect/change expired-inactive survey message
I cleared the cache and putted the alert in custom.js and I see the alert.
But the error custom message script is still not working
Laura

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 5 Tage her #169763 von tpartner
tpartner antwortete auf das Thema: Redirect/change expired-inactive survey message
The workaround works for me. Unfortunately, I cannot debug your problem without seeing a test survey.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: LouisGac

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha