Ext.onReady(function() { var error = ''; var altura = 160; var exibeMsgErro = true; if(error != '') { altura = 180; exibeMsgErro = false } Ext.BLANK_IMAGE_URL = './images/s.gif'; Ext.QuickTips.init(); var login = new Ext.FormPanel({ id : 'idFrmLogin', formId : 'frmLogin', iconCls : 'lock', labelWidth : 65, padding: 10, url : 'j_security_check', frame : true, title : 'Login [SBE]', defaultType : 'textfield', monitorValid : true, items : [{ id: 'j_username', fieldLabel : 'Usuário', name : 'j_username', allowBlank : false, labelSeparator: '', width: 170, blankText : 'Digite o login do usuário !' }, { fieldLabel : 'Senha', name : 'j_password', id: 'j_password', inputType : 'password', allowBlank : false, labelSeparator: '', width: 170, enableKeyEvents : true, blankText : 'Digite a senha do usuário !' }, { xtype: 'box', hidden: exibeMsgErro, html: '
Usuário / Senha inválida
' } ], buttons : [{ text : 'Login', formBind : true, id: 'idBtbLogin', handler : function() { var campoSenha = login.getForm().findField("j_password"); campoSenha.setValue(hex_md5(campoSenha.getValue())); login.getForm().getEl().dom.action='j_security_check'; login.getForm().getEl().dom.submit(); } }] }); var win = new Ext.Window({ layout : 'fit', width : 300, height : altura, margins: { top: 50, right: 50, bottom: 50, left: 50 }, closable : false, resizable : false, plain : true, border : false, items : [ login ] }); Ext.getCmp('j_password').on('keypress', function(obj, event) { if(Ext.EventObject.ENTER == event.getCharCode()) { if(obj.getValue()) { if(obj.getValue().length > 0) { Ext.getCmp('idBtbLogin').handler.call(); } } } } ); win.show(); //Ext.getCmp('j_username').focus(false, 100); });