Form designer: Automatic saving of the current form content after configurable time delay


#1

Solution

You have to install a JavaScript library to auto submit the form after a specified time delay.

The JavaScript library must be installed in the \wfgen\wfapps\webforms\js folder.

On the Web References tab in the Form configuration panel:

  1. Check Include jQuery API and jQuery UI libraries.

  2. In the textarea, insert the following JavaScript code with an idle duration of your choice:

<script src="/wfgen/wfapps/webforms/js/ifvisible.js"></script>

<script>
    $(document).ready(function(){
        // Code executed in Runtime only
        if (typeof $selectedObject === "undefined")
        {
            // Set the idle limit to 10 seconds
            ifvisible.setIdleDuration(10);
            
            // Confirm save as draft if no activities more than 10 seconds.
            ifvisible.idle(function(){
                var r = confirm("There are no activities for more than 10 seconds!\nSave this form as draft?");
                if (r == true) {
                    $('#saveAsDraftButton').click();
                }
            });
        }
    });
</script> 

#2

The javascript code is missing in the solution of this article under #2


#3

Hi Supriya,

Thanks for letting us know. The code has been re-inserted.

Best wishes,

Peter Nicoll


#4

I just tried this and it does work in regards to a time limit. What I also noticed is that if the browser has other tabs open, the confirm box appears even if the time limit is not reached (and it can block the user from going to another tab). Any ideas or is there another solution (jquery or .Net code) to save as draft if there is not activity in a certain time?

Thanks,

James


#5

Think I may have that problem solved. I checked the Github page and there is this code that can be included:

ifvisible.on("blur", function(){
	// example code here..
	animations.pause();
});

ifvisible.on("focus", function(){
	// resume all animations
	animations.resume();
});