View Full Version : Submit only dirty fields in 3.4 form

27 Feb 2014, 7:55 AM

I have a form panel(Ext.form.FormPanel) with some fields. I wish to submit only dirty fields.
So I added a beforeaction event

beforeaction: function(form){
form.items.each( function(field){
if (!field.isDirty()&&field.getName().indexOf('picker')==-1) {
//console.log('>>>>>>Exclude '+field.getName()+' '+field.submitValue);
field.setDisabled(true);// do the trick, but visible changes ofcourse
//field.submitValue=false; // did not work
//form.remove(field); // did not work
//console.log('>>>>>>Change '+field.getName()+' '+field.submitValue);
//field.render();// did not help
//form.render(); // did not help

As expected the event fires before I call submit in a handler function, but only field.setDisabled(true); prevents the submission of the fields to the server action.
What am I missing other can not understand ? Is there other way/place to deal with such case ?
Thanks in advance for the help.

3 Mar 2014, 8:56 AM
The code for this is in Ext.lib.Ajax.serializeForm method. You would have to override this method to only allow non-dirty fields to add the value.