0

I have the following code

    var record = form.getRecord();
    var values = form.getValues();
    record.set(values); 
   // record.data.DeliveryFrom = "test1";
    record.set('DeliveryFrom', 'test2');
    record.save();

I wish to override the property DeliveryFrom after i get the values from my form. However i when i view the results in firebug DeliveryFrom is null. You will see above i tried 2 different ways to set this value.

I'm using extjs 4.1

sha
  • 17,824
  • 5
  • 63
  • 98
frosty
  • 5,330
  • 18
  • 85
  • 122
  • take a look at this... http://stackoverflow.com/questions/11762050/ext-js-4-convert-json-object-to-another-json-object-using-javascript – JustBeingHelpful Aug 27 '12 at 23:17

1 Answers1

1

This should work (assuming that form its Ext.form.Basic) if not (if its Ext.form.Panel), then use form.getForm():

var record = form.getRecord();
form.updateRecord(record); //We use update record, its almost the same as you were using but in just one call
record.beginEdit(); //Put the record in edit mode
record.set( 'DeliveryFrom', 'test2');
record.endEdit(); //End editing the record and commit changes
record.save(); //Commit changes to backend
VoidMain
  • 1,987
  • 20
  • 22