Autosaving forms reliably - timer?

Soldato
Joined
16 Nov 2003
Posts
9,682
Location
On the pale blue dot
I'm currently building a PHP powered web form. The user is required to enter quite a fair amount of data so they need some sort of office style autosave while they work which would dump their info into SQL in case the browser crashes or they close it or whatever.

I was thinking of using a javascript timer, but from other non-web projects in the past I've always been told to avoid timers, as they are often not reliable. Now I don't need to measure down the millisecond but do you reckon that a javascript timer would be okay to say, save after ten minutes on the form?

If not, what else would you suggest?
 
Associate
Joined
30 Dec 2005
Posts
415
Why not break down the one form into several different pages, and save the user's data to a php session after they have completed each page?

If it is a large form, it would probably be best to break it down into smaller chunks, so this would be an ideal solution :)
 
Soldato
OP
Joined
16 Nov 2003
Posts
9,682
Location
On the pale blue dot
toastyman said:
Why not break down the one form into several different pages, and save the user's data to a php session after they have completed each page?

If it is a large form, it would probably be best to break it down into smaller chunks, so this would be an ideal solution :)

Good idea in theory but I can't. The majoriy of the form time will be devoted to a text box that needs a lot of data in it so it can't be split, and one of the key requirements is to have one simple form. :(
 
Soldato
Joined
18 Oct 2002
Posts
5,464
Location
London Town
I've used AJAX requests to do something similar to this in the past. Though I didn't complete the project I implemented it in, so I haven't actually tested its reliability in the wild. Seemed to work fine in testing.

For a CMS-style application, I monitored keypress events in the textarea input box and periodically e.g. when there's a pause after keypresses, I would send all the form data using XMLHttpRequest to a script that would store it all in a session object (in my case, the session store was a DB, but I'm sure you could use regular sessions). I also offered a save button that performed the same functionality i.e. the save occured in the background, and didn't refresh the page.

Things to consider are the load caused by the constant server hammering, if you're autosaving frequently, and ensuring the reliability of the data saved.

Using the AJAX request, you could also visually update the page with notification of an autosave, and provide info such as 'last saved 3 minutes ago'.

Still, the entire form was spilt over several screens to avoid information overload and simplify the process of entering data.
 
Man of Honour
Joined
31 Jan 2004
Posts
16,335
Location
Plymouth
There's always risk if you have One Large Textbox...what if the user accidentally deletes everything and that then goes through and is saved? They still have to re-type :(

Best thing is to ask your users to take care, or to use a text editor to write the Big Part, or copy the contents to the clipboard - as well as the autosave...perhaps with some protection for length changes :)
 
Soldato
OP
Joined
16 Nov 2003
Posts
9,682
Location
On the pale blue dot
Beansprout said:
There's always risk if you have One Large Textbox...what if the user accidentally deletes everything and that then goes through and is saved? They still have to re-type :(

Best thing is to ask your users to take care, or to use a text editor to write the Big Part, or copy the contents to the clipboard - as well as the autosave...perhaps with some protection for length changes :)

Yeah I know its crazy but this is a wacky internal corporate project and they are very picky on what they want, despite what we tell them!

All of your suggestions on writing it externally and pasting it in would be what I would do, but we have to assume next to no IT literacy. Fun stuff :D
 
Soldato
Joined
18 Oct 2002
Posts
5,464
Location
London Town
Beansprout said:
There's always risk if you have One Large Textbox...what if the user accidentally deletes everything and that then goes through and is saved? They still have to re-type :(
It might be quite a neat idea, if it's just saving a single textarea, to save several revisions in session. Then the user can rollback if they screw up. Or simply don't autosave if the textarea is empty.
 
Back
Top Bottom