The Kat's Work - Blog
Main | Blog | Registration | Login
Thursday
2024-03-28
5:28 PM
Welcome Guest | RSS
Main » 2010 » September » 14

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.
Views: 3735 | Added by: The_Kat | Date: 2010-09-14 | Comments (0)

Login form
Adverts
Search
Calendar
«  September 2010  »
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
2627282930
Entries archive
Site friends
  • Create your own site
  • Spree4.com
  • My Blog
  • Statistics

    Total online: 1
    Guests: 1
    Users: 0
    spree4
    Copyright MyCorp © 2024
    Website builderuCoz