cydewaze — 2013-05-09T13:49:26-04:00 — #1
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.
chris_upjohn — 2013-05-10T00:42:06-04:00 — #2
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.
paul_wilkins — 2013-05-10T01:05:10-04:00 — #3
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.
Or, if you don't want to roll your own solution, there are a [number of [URL="https://github.com/nervetattoo/jquery-autosave"]jquery [URL="https://github.com/BenGriffiths/jquery-save-as-you-type"]form [URL="http://www.simonbattersby.com/blog/using-the-jquery-autosave-plugin/"]autosave [URL="https://bitbucket.org/stanlemon/jquery-autosave/src"]plugins](http://www.thekludge.com/form-auto-save-with-jquery-serialize/) that make it much easier to achieve.
cydewaze — 2013-05-10T10:58:17-04:00 — #4
Thanks Paul, I'll look at those plugins. I am pretty hopeless when it comes to JS!
I'd seen some of those plugins, but I was wondering if anyone had a specific one to recommend out of them.