Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Delay Endurl Redirect

  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 11 months ago #108129 by dweisser
Delay Endurl Redirect was created 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:
Code:
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.
Code:
$(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
The topic has been locked.
  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 11 months ago #108132 by dweisser
Replied by dweisser on topic Delay Endurl Redirect
So I got this to work...
Code:
$(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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #108144 by tpartner
Replied by tpartner on topic Delay Endurl Redirect
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.
The topic has been locked.
  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 11 months ago #108146 by dweisser
Replied by dweisser on topic Delay Endurl Redirect
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #108148 by tpartner
Replied by tpartner on topic Delay Endurl Redirect
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.
The topic has been locked.
  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 11 months ago #108149 by dweisser
Replied by dweisser on topic Delay Endurl Redirect
The survey is not-token based.
So is there even an active session? Why would there be?
The topic has been locked.
  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 11 months ago #108153 by dweisser
Replied by dweisser on topic Delay Endurl Redirect
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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose