-
23 May 2008 12:53 PM #1
Can't get form.getForm().reset() to work
Can't get form.getForm().reset() to work
Hi,
I'm having problems with form reset... i have a form that is used for add (no initial values) and for edit. The problem is that if edit a register first, when i open the add form, it has the values from the last edition... even if i call form.getForm().reset().
I also tried with trackResetOnLoad true or false... but the problem is always the same... can anybody help please! I'm using ExtJs 2.1.
Thanks in advance
Carlos
-
23 May 2008 2:14 PM #2
please post your form code (including button config). impossible to answer unless we can see what your doing.
thanks
-
23 May 2008 2:42 PM #3
Thanks for reply... here's the code... when doing reset, the form come up with the last values that were filled during edit action (basic setValues for all fields).
=====
var grid = new Ext.grid.GridPanel({
<several grid options here>
tbar:[{
text:'Add Payment',
tooltip:'Add a new payment',
iconCls:'add',
handler: function(){
form.getForm().reset();
formWindow.setTitle('Add Payment');
formWindow.show();
AddSubmitButton.show();
EditSubmitButton.hide();
f1DateField.setValue(new Date());
}
}]
});
grid.render();
var form = new Ext.form.FormPanel({
baseCls: 'x-plain',
labelWidth: 60,
monitorValid: true,
items: [f1DateField, f2MethodField, f3AmountField, f4RefField],
buttons: [AddSubmitButton, EditSubmitButton,
{
text: 'Cancel',
handler: function(){
FormWindow.hide();
}
}]
});
var formWindow = new Ext.Window({
width: 275,
height:225,
modal: true,
layout: 'fit',
plain:true,
loadMask: true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: [form],
closable: false,
resizable: false
});
====
Thanks
Carlos V.
-
23 May 2008 3:31 PM #4
try moving your form reset to after the window is shown.
-
23 May 2008 4:13 PM #5
Unfortunately i tried that before without success

-
2 Mar 2009 6:25 AM #6
form.getForm().reset() doesn't reset the form
form.getForm().reset() doesn't reset the form
I 'm having the same problem, no answer to this thread from support team??????

-
2 Mar 2009 8:18 AM #7Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
22 Jul 2009 4:10 PM #8
I had the same problem.
Added this to the formPanel to solve it:
Code:// a hack to get reset() to work resetFields: function() { formPanel.findBy(function(comp){if (comp.fieldLabel) comp.reset();}); },
-
1 Jan 2010 2:53 PM #9
I have managed to find a workaround, simply by setting values of the form, after I call show() method of the window. This way the form is first rendered with no values set, and its initial state contains empty fields. Since reset() method always returns to the initial state, this sequence works fine.
Hope this helps.
Happy new year to you all.
-
5 Jan 2010 6:47 AM #10Sencha Premium Member
- Join Date
- Feb 2009
- Location
- Amsterdam, The Netherlands
- Posts
- 217
- Vote Rating
- 2


Reply With Quote