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.
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 && 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 support
-
Plugins, theme and development
. I don't answer to private message.