SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Need a recommendation on an autosave script

    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.
    <cfset myblog = "http://cydewaze.org/">

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    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.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cydewaze View Post
    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.
    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 jquery form autosave plugins that make it much easier to achieve.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.
    <cfset myblog = "http://cydewaze.org/">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •