To try and master jQuery I've been playing with a few ideas.  I decided to
flesh this one out for use on one of my sites and in hopes it can benefit
someone else as well I'm making it available.  Depending on your view of
network traffic this may have limited potential for you, but it's free so no
complaining ;)

autoSave will automatically submit individual fields in a form as you make
changes, preventing users from losing form data should the power fail, or
they get called away to watch the last 3 tivo'd episodes of 24 as their
browser session expires.  Its most useful potential is for quick editing
database records but you can use it for just about anything.

You call it using $("yourFormInputs").autoSave( Function, Map ); and that's
pretty much it.  You just need to write the backend handler to deal with the
field data as it hits the server.  I'll post some tricks I use with Cold
Fusion on the blog I set up later.

A basic example using pure jQuery:

$(document).ready(function(){
    $(":input").autoSave(function(){
        var ele = new Object();
        // remember that this function runs in the scope of the element
itself.
        ele[this.name] = (this.type =="checkbox") ? this.value + "|" +
this.checked : this.value;
        $.post("test.cfm", ele, function (data)
{$("#ResultDiv").empty().append(data);} )
    });
});

You can read more about it here:
http://daemach.blogspot.com/2007/03/autosave-jquery-plugin.html
-- 
View this message in context: 
http://www.nabble.com/*New-jQuery-plugin*---autoSave-tf3406522.html#a9489030
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to