I have an extjs2 formpanel:
var fsf = new Ext.FormPanel({ labelWidth: 75, // label settings here cascade unless overridden frame:true, id: 'formPanel', title: 'Simple Form with FieldSets', bodyStyle:'padding:5px 5px 0', width: 550, items: [{ xtype:'fieldset', checkboxToggle:true, title: 'User Information', autoHeight:true, defaults: {width: 210}, defaultType: 'textfield', collapsed: true, items :[{ fieldLabel: 'First Name', name: 'first', allowBlank:false },{ fieldLabel: 'Last Name', name: 'last' },{ fieldLabel: 'Company', name: 'company' }, { fieldLabel: 'Email', name: 'email', vtype:'email' } ] },{ xtype:'fieldset', title: 'Phone Number', collapsible: true, autoHeight:true, defaults: {width: 210}, defaultType: 'textfield', items :[{ fieldLabel: 'Home', name: 'home', value: '(888) 555-1212' },{ fieldLabel: 'Business', name: 'business' },{ fieldLabel: 'Mobile', name: 'mobile' },{ fieldLabel: 'Fax', name: 'fax' } ] }], buttons: [{ text: 'Save', handler: function(){ var form = Ext.getCmp('formPanel').getForm(); if(form.isValid()) form.submit({ waitMsg:'Loading...', url: 'RepeatSession.jsp', success: function(form,action) { //we have to close the window here!! }, failure: function(form,action){ Ext.MessageBox.alert('Erro',action.result.data.msg); } }); } },{ text: 'Cancel' }] });
and window:
win = new Ext.Window( { layout: 'fit', width: 500, height: 300, modal: true, closeAction: 'hide', items: fsf }); win.show();
As you can see, the form panel is inside the window as an element. I have to close the window after the form is submitted successfully, but I donβt know how to access the window object inside my success handler.
How can I hide the window after the form is submitted successfully?