You are viewing limited content. For full access, please sign in.

Question

Question

Feature Request: Auto Save Forms

asked on December 10, 2015

I have had a request from an end user to be able to have the system auto save a form when it is being filled out by a licensed user. We have a few forms that can take a while to fill out. Example: One of our forms is an employee evaluation form and can take up to an hour to fill out, if not longer. Sometimes things happen and their tab closes or internet connection gets interrupted, etc. and they have just lost an hour worth of work.

I know it is possible for them to save as a draft manually, but it would be fantastic if Forms had the ability to auto save every X number of minutes. This could create a draft of the form for a new form, and with Forms 10 for a form being edited at a user task it could save the instance of the form the same way that can be done manually.

This would save a lot of headache for our users and would be greatly appreciated.

2 0

Answer

SELECTED ANSWER
replied on November 22, 2019

This was added in Forms 10.4

0 0

Replies

replied on May 23, 2017 Show version history

Hi Blake. Coincidentally I was looking for the same feature right now, as many of our customers are timing out. It makes sense that if the customer is typing a long form, that eventually he/she might need to step out or pick up a phone call, or something. In our case we can't divide the form into sections right now so, in lack of finding a feasible solution for us, I put together a simple one from different other projects, that I had worked on before.

The script will not time out, unless there is no activity in the form. I have it set to 3 seconds so you can test it, but adjust as needed.

Upon the form reaching its timeout time, it will display an alert as the image attached. Then it will wait for 20 seconds and auto-save. I couldn't make the alert work in IE so the form will simply save without notice; which is no big deal. I had another version where the form saves automatically, regardless of there been activity or not, but decided to go with the version below. 

I hope someone else finds it useful and can improve it further.

You would need to activate the "Save as Draft" feature in the Process Diagram of course. I also added this CSS in the CSS Section, to make the title stand out in red.

 

.modal-title {
 color: red; 
}

function myFunction() {
  
    var ms_ie = false;
    var ua = window.navigator.userAgent;
    var old_ie = ua.indexOf('MSIE ');
    var new_ie = ua.indexOf('Trident/');

    if ((old_ie > -1) || (new_ie > -1)) {
        ms_ie = true;
    }

    if ( ms_ie ) {
      
      $(this).parents(".draft-btn").click();
        //IE specific code goes here
    }
  else
  {
    $(".draft-btn").click();
  }

    //$(this).parents(".draft-btn").click();
    //$(".draft-btn").click();
    $('.modal-title').html("You have been too long in this form. Your form will be auto-saved in 20 seconds in order to avoid losing all your data. Click \"Save\" to save now.");

  setTimeout(function(){  
  
  $('.btn-primary').click(); // uncomment to bypass the alert and force Save
  
     }, 20000);  //20 seconds, for testing purposes       
}

 

function listener() {

//10000 is 10 seconds

     //window.time = 300000, // 5 minutes
	   window.time = 3000, // 3 seconds, for testing purposes, use line above for 5 minutes or adjust
          
     delta = 100,

 

    window.tid = setInterval(function() {  

        window.time -= delta;

        console.log(window.time);

        if ( time <= 0 ) {

            clearInterval(window.tid);

            myFunction(); // time passed 

        }       

    }, delta);

 

};

 

    listener();

 

     $(document).on('keyup keypress blur change mousemove',function(){

        clearInterval(window.tid);

        listener();

    });

 

SaveAsDraft.png
SaveAsDraft.png (30.01 KB)
4 0
replied on May 23, 2017

This looks great! I will try to test it this week and let you know my feedback. Will this work for User Tasks or just for the initial submission?

0 0
replied on May 23, 2017

It should work for any User Task, as long as its form has the JavaScript. I still need to implemented myself, so we'll be testing at the same time. Let me know of any improvements so we can pitch the idea better over here as well.

0 0
replied on July 12, 2017

Hi Raul - you've done great work here! It's doing exactly what it's supposed to do when initiating a process, but I can't get it to work in any User Tasks once the process is under way. I am testing using only a single form in this process, so it's the exact same JavaScript between steps.

Have you gotten a chance to test this in User Tasks yet, and if so do you have any tips?

Thanks - Jim

0 0
replied on August 8, 2017

Hi Jim, I'd gotten tied up with other items and was never able to come back to it until today. I needed the same thing in the User Tasks and also couldn't get it to work using the first script so I modified it a little. I would still use the first script for initial forms and this new one for User Tasks. I've set the time to 3 seconds for testing purposes. Remember that it will only save when there is inactivity so leave it alone for 3 seconds to see if it works for you. This one worked for me in IE/Chrome/Firefox but I left the MSIE code for anyone with an older version of IE that might want to tweak it further.

This was tested using Forms 10.2.1

// Save as draft automated  - For User Tasks
  function myFunction() {
  
    var ms_ie = false;
    var ua = window.navigator.userAgent;
    var old_ie = ua.indexOf('MSIE ');
    var new_ie = ua.indexOf('Trident/');

    if ((old_ie > -1) || (new_ie > -1)) {
        ms_ie = true;
    }

    if ( ms_ie ) {
      
      $('.btn-primary', window.parent.document).click();
        //IE specific code goes here
    }
  else
  {
    $('.btn-primary', window.parent.document).click();
  }


   
}

 

function listener() {

//10000 is 10 seconds

     //window.time = 300000, // 5 minutes
	   window.time = 3000, // 3 seconds, for testing purposes, use line above for 5 minutes or adjust
          
     delta = 100,

 

    window.tid = setInterval(function() {  

        window.time -= delta;

        console.log(window.time);

        if ( time <= 0 ) {

            clearInterval(window.tid);

            myFunction(); // time passed 

        }       

    }, delta);

 

};

 

    listener();

 

     $(document).on('keyup keypress blur change mousemove',function(){

        clearInterval(window.tid);

        listener();

    });
    
 // Save as draft automated 

 

0 0
replied on August 8, 2017

Wow Raul, this is working exactly the way I need it to! I can't thank you enough for your ingenuity - thanks for sharing with us! smiley

-Jim

0 0
replied on March 29, 2018

Raul, that window.parent.document parameter just saved me after lots of frustration. I can now automatically release tasks after a set time-out period. Thank you!

0 0
replied on March 29

Is there some updated code that works with the modern designer by chance? This works perfectly with the classic designer but I want to implement something similar on a form that is configured in the modern designer. 

0 0
replied on March 29

Auto Save is now built in to Forms starting with version 10.4. You can configure it in the /FormsConfig page.

0 0
replied on May 8, 2017

Has there been any discussion about this Laserfiche? We are finding that client's are using Google Forms for cases like this because it has an auto save feature that prevents the issue of losing the entered data.

2 0
replied on December 10, 2015

If the goal is to minimize or prevent accidental loss of the information typed into the form, I don't think an auto-save is necessary at all. With Forms 10 you can break the form into sections, and have each section assigned to a user task. Assign each user task to the initiator, hook them up to each other one after the other, and you basically get the ability to save a section on the server and have the next one load. Then you would have a master form that's a combination of all the variables, and have that saved in the repository.

0 0
replied on December 10, 2015 Show version history

That is an interesting option for Forms 10, but I think it would muddy up the history of that submission when it is saved into the repository.

I could see that being very useful though if the history was not being saved.

Also, in this case they are not necessarily working on a specific section before another.

2 0
replied on March 26, 2021

would this work on the message start event as well? not just a user task?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.