Ext.onReady(function(){ var simple = new Ext.FormPanel({ labelWidth: 75, // label settings here cascade unless overridden frame:false, title: 'Please login to your support account', bodyStyle:'padding:10px 10px 10px 10px', width: 350, defaults: {width: 230}, defaultType: 'textfield', items: [{ fieldLabel: 'Name', name: 'username', allowBlank:false },{ fieldLabel: 'Company', name: 'customer_name' }, { fieldLabel: 'Email', name: 'email', vtype:'email' } ] }); var win = new Ext.Window({ title:"Support", autoHeight:true, shadow:false, modal : true, closeAction:'destroy', bufferResize: true, id:'', items: simple , bbar: [ '->', { text: 'Next', handler: function(){ doLogin(); }, iconCls:'ico-delete' } ] }); function doLogin(){ simple.getForm().submit({ url:"system.php", params:{ task:"login" }, waitMsg:'Verifying', success:function(form, action){ obj = Ext.util.JSON.decode(action.response.responseText); if(!obj.success){ Ext.Msg.alert('Error !', obj.message ); } else{ window.location.href = "index.php"; } }, failure:function(form, action){ obj = Ext.util.JSON.decode(action.response.responseText); Ext.Msg.alert('Error !', "Please fill in all the required fields before you save!" +obj.message); } }); } win.show(); });