Ext.onReady(function(){ document.title='CMR Online ***WEB 2***'; Ext.QuickTips.init(); Ext.BLANK_IMAGE_URL = '../_libs/extjs331/resources/images/default/s.gif'; // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var unameFld = new Ext.form.TextField({ fieldLabel: 'Username', name: 'uname', id: 'frmUnameFld', allowBlank:false }); var passFld = new Ext.form.TextField({ fieldLabel: 'Password', allowBlank: false, name: 'key', id: 'frmPassFld', inputType: 'password' }); //#############################login form submit###########################// var loginForm = new Ext.FormPanel({ labelWidth: 65, // label settings here cascade unless overridden frame:true, id:'mainLoginForm', collapsible: false, title: 'CMR Online ***WEB 2***', width: 300, iconCls:'x-icon-cmr', bodyStyle:'padding:5px', buttonAlign: 'center', defaults: {width: 160}, hideLabels: false, renderTo: 'mainPanel', labelAlign: 'right', items: [unameFld,passFld ],buttons: [{ text: 'Login', id: 'formSubmitBtn', iconCls:'x-icon-login', handler: function(){formSubmitMarshaller();} },{ text: 'Clear', iconCls:'x-icon-reset', handler: function(){loginForm.form.reset();} }] }); //#############################login form###########################// //#############################login form submit###########################// function formSubmitMarshaller(){ loginForm.form.submit({ url: 'inc/auth.php?do=login', waitMsg:'Logging in...', success: function(loginForm,action) { document.title += ' is now loading...'; Ext.MessageBox.alert('Form Authentication Succeeded', action.result.pMessage); window.location.replace('/Home/index.php?sk='+action.result.sk); }, failure: function(loginForm,action) { Ext.MessageBox.alert('Form Authentication Error', action.result.pMessage ); passFld.reset(); } }); } //#############################login form submit###########################// //set the focus to be on password passFld.focus(); //let the enter key submit the form var map = new Ext.KeyMap('mainPanel', { key: 13, // or Ext.EventObject.ENTER fn: formSubmitMarshaller, scope: loginForm }); });