Hybrid View

  1. #1
    Ext User
    Join Date
    May 2008
    Posts
    12
    Vote Rating
    0
    cvieira is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha User
    Join Date
    May 2008
    Posts
    17
    Vote Rating
    0
    ktilt is on a distinguished road

      0  

    Default


    please post your form code (including button config). impossible to answer unless we can see what your doing.

    thanks

  3. #3
    Ext User
    Join Date
    May 2008
    Posts
    12
    Vote Rating
    0
    cvieira is on a distinguished road

      0  

    Default


    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.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    try moving your form reset to after the window is shown.

  5. #5
    Ext User
    Join Date
    May 2008
    Posts
    12
    Vote Rating
    0
    cvieira is on a distinguished road

      0  

    Default


    Unfortunately i tried that before without success

  6. #6
    Ext User
    Join Date
    Jan 2009
    Posts
    9
    Vote Rating
    0
    Sina is on a distinguished road

      0  

    Default 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??????