Try to use something like this...

var form = function() {
var self = this;

  this.holdData = function() {
     $(':input').each(function(i, field) {
        $(this).data('value', $(this).val())
     });
     return self;
  };
  this.retrieveData = function() {
     $(':input').each(function(i, field) {
       $(this).val($(this).data('value')).removeData('value')
     });
     return self;
  };
};

  This way you save the input's value in the object's data holder....
if you need to set/retrieve an individual value you can always do the
following

  $("#name").val( $(this).data('value') ) // removing the data is
optional, but recommended to avoid old data conflict... I use this
code a lot and it works as a swiss knife

Regards,
Alwin

Reply via email to