I just finished a large form (40+ fields) that will take users some time to complete. There are a lot of textareas, so a lot of typing (or copy/pasting) will be involved, so I don’t want users to lose information they entered.
I was searching Google for an auto-save (sort of like the one on this forum) but they all look like they function very differently. I’m assuming the auto-save submits the info to my database, but maybe I’m wrong. Do they save the info to a temp file somewhere? Does anybody have a favorite one they can recommend?
We already load jQuery on each page, so that’s available to use.
What is your browser support like? If you are only supporting IE8+ then you can use localStorage and serialize the form into a JSON object, from there you can use JSON.stringify() as localStorage only accepts strings.
There are a couple of good ways of doing an autosave. If you’re dealing with less than 4096 bytes of data, you can easily store the information as a cookie. See for example: https://github.com/carhartl/jquery-cookie
If there’s likely to be more than 4096 bytes, then storing it as local data is a better solution. jQuery has a good data api to help you with that.