Welcome to the LimeSurvey Community Forum

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

Exit, clear and restart survey after x-minutes on the one page

  • joebloggs1987
  • joebloggs1987's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178308 by joebloggs1987
I'm wanting to find a way to clear and restart a survey if the user spends more than a certain amount of time on the one page (i.e. if the question group time exceeds x-minutes, to exit and clear responses and restart the survey from the first question group).
This will be an open survey, not token based.

Is there any way to do this in Limesurvey?

Thanks in advance.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178309 by DenisChenu
I do a js system to autosave survey after X minutes (here 10).
Code:
var outTimer;
var alertTimer;
var countTimer;
var idleTime = 0;
var surveyTimeOut = 10;
$(document).ready(function() {
    var idleInterval = setInterval(timerIncrement, 60 * 1000); // One minute 60 * 1000
 
});
$(document).on('click keypress mousemove scroll',function(){
    idleTime = 0;
});
function timerIncrement() {
    idleTime = idleTime + 1;
    if(surveyTimeOut &amp;&amp; surveyTimeOut <= idleTime) {
        $("form#limesurvey [name='saveall']").click();
    }
}
You can easily replace action to reset the survey here ( window.location.href = "/index.php/sid/1234?newtest=Y " )

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: joebloggs1987
The topic has been locked.
  • joebloggs1987
  • joebloggs1987's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178419 by joebloggs1987
Perfect! Exactly what I needed!
Cheers mate. :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose