- Posts: 23
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Redirect/change expired-inactive survey message
- FaLifeTime
- Topic Author
- Offline
- Junior Member
Less
More
6 years 10 months ago #153503
by FaLifeTime
Redirect/change expired-inactive survey message was created by FaLifeTime
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]
I read this thread without success.
Thanks,
4aLifeTime[/color][/color]
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
6 years 10 months ago #153516
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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
The topic has been locked.
- FaLifeTime
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
- Thank you received: 0
6 years 10 months ago #153524
by FaLifeTime
Replied by FaLifeTime on 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!');
}
}
});
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!');
}
}
});
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
6 years 10 months ago #153529
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Redirect/change expired-inactive survey message
I see a bug (a missing closing quote) in that code so it should be:
However, if using Spanish, you will need to replace the German string with whatever you see in Spanish. Probably this:
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):
Code:
$(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:
Code:
$(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):
Code:
$(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.
The topic has been locked.
- FaLifeTime
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
- Thank you received: 0
6 years 10 months ago #153530
by FaLifeTime
Replied by FaLifeTime on topic Redirect/change expired-inactive survey message
Thanks tpartner. It works perfectly!
Cheers,
4aLifeTime
Cheers,
4aLifeTime
The topic has been locked.
- SCHEP23
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
5 years 9 months ago - 5 years 9 months ago #169542
by SCHEP23
Replied by SCHEP23 on topic Redirect/change expired-inactive survey message
Hi this workaround works also in version 3? Where I have to put the instruction?
Thanks
Laura
Thanks
Laura
Last edit: 5 years 9 months ago by SCHEP23.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
5 years 9 months ago #169570
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Redirect/change expired-inactive survey message
The code would be placed in custom.js.
Which workaround? There are two given above.
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.
The following user(s) said Thank You: SCHEP23
The topic has been locked.
- SCHEP23
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
5 years 9 months ago #169575
by SCHEP23
Replied by SCHEP23 on topic 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
$(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
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
5 years 9 months ago #169630
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Redirect/change expired-inactive survey message
Place something like this is custom.js:
Code:
$(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.
The topic has been locked.
- SCHEP23
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
5 years 9 months ago - 5 years 9 months ago #169695
by SCHEP23
Replied by SCHEP23 on topic Redirect/change expired-inactive survey message
Thanks, i paste this script in theme custom.js but nothing happened.
It's the right place?
Laura
It's the right place?
Laura
Last edit: 5 years 9 months ago by SCHEP23.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
5 years 9 months ago #169700
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic 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.
The topic has been locked.
- SCHEP23
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
5 years 9 months ago #169723
by SCHEP23
Replied by SCHEP23 on topic 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
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
The topic has been locked.