Check out the LimeSurvey source code on GitHub!

Delay Endurl Redirect

More
2 years 8 months ago #108129 by dweisser
Hi all,
I'd like to be able to show respondents the end page and then, 5 seconds later, redirect the browser to the welcome page of the survey.

I'm experimenting with:
var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
figuring that if it is null, then i can apply a timer to a new window location, but i'm getting a javascript error.
$(document).ready(function(){
    function redirectUser(){
    window.location = "www.google.com";
    }
        // Find the group index - 
        var groupIndex = $('div[id^="group-"]').attr('id').split('group-')[1];
            if(groupIndex == "") {
                }
            else {
            setTimeout('redirectUser()', 2000);
            }
});

Surely there is a simpler way. Any thoughts would be most appreciated.
David

Please Log in to join the conversation.

More
2 years 8 months ago #108132 by dweisser
So I got this to work...
$(document).ready(function(){
 
var groupIndex = $('div[id^="group-"]').attr('id');
groupIndex = groupIndex ? groupIndex.split(' ').slice(-1)[0] : '';
            if(groupIndex != 0) {
                }
            else {
            setTimeout('window.location = "http://www.google.com"', 2000);
            }
});

I'm just not sure why it works. Any thoughts would be very much appreciated.

Please Log in to join the conversation.

More
2 years 8 months ago #108144 by tpartner
Rather than testing for elements, you could simply place the timeout function in completed.pstpl.


.

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
2 years 8 months ago #108146 by dweisser
Makes sense, TPartner - Thanks.
On a related issue, I need to keep the survey on the Welcome screen. The survey is being fielded in a kiosk-like situation. The trouble is that the session times out and the user sees "Your session has timed out" upon pushing the "Next" button.

Can I similarly set up a timer whereupon on session timeout, the session is "refreshed". Does refreshing the browser restart the session?
David

Please Log in to join the conversation.

More
2 years 8 months ago #108148 by tpartner
Sorry, don't know, you will need to test that.


.

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
2 years 8 months ago #108149 by dweisser
The survey is not-token based.
So is there even an active session? Why would there be?

Please Log in to join the conversation.

More
2 years 8 months ago #108153 by dweisser
Scratch that. Better Solution:
Turn off the welcome page.
Create a new stand-alone page with a link to the survey.
:-).
Sometimes it helps just to talk things out. thanks as always.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form