The Kat's Work - Blog
Main | Blog | Registration | Login
Friday
2017-11-17
5:26 PM
Welcome Guest | RSS
Main » 2010 » September » 14 » AutoSave using Jquery and Java Struts. - Part 1 Setting up the form.
2:44 PM
AutoSave using Jquery and Java Struts. - Part 1 Setting up the form.
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: 3074 | Added by: The_Kat | Tags: jquery, AutoSave, Struts, JAVA, Java Struts | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
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 © 2017
    Website builderuCoz