In the first part of my how to guide (or more how i did it guide.)
I'll simply tell you how to set up the form to store using javascript the fields that have been changed. (hence the fields that need auto saving.)
var nextNum = 0; var changedFields = new Array(); jQuery.noConflict(); jQuery(document).ready(function() {
jQuery('input').bind('change', function() { changedFields[nextNum] = this.name; nextNum++; jQuery(this).unbind('change');
});
jQuery('textarea').bind('change', function() { changedFields[nextNum] = this.name; nextNum++; jQuery(this).unbind('change');
}); jQuery('select').bind('change', function() { changedFields[nextNum] = this.name; nextNum++; jQuery(this).unbind('change');
});
});
The above code will add the name of each input, textarea and select that is changed to the array changedFields which the autosave function will use later. Warning tough certain third party add ons will not trigger an change event and must be dealt with seperatly i will show this for nic editor later in an advanced setup.
|