Código Javascript:
Ver original
Ext.QuickTips.init(); Ext.onReady(function(){ var fp = new Ext.FormPanel({ id: 'status-form', renderTo: Ext.getBody(), labelWidth: 75, frame: true, monitorValid:true, width: 350, buttonAlign: 'right', border: false, bodyStyle: 'padding:10px 10px 0;', defaults: { anchor: '95%', allowBlank: false, selectOnFocus: true, msgTarget: 'side' }, items:[{ xtype: 'textfield', fieldLabel: 'Login', id: 'login', name: 'login', minLength: 2, blankText: 'Ingrese su Usuario' },{ xtype: 'textfield', fieldLabel: 'Password', id: 'password', name: 'password', minLength: 2, inputType: 'password', allowBlank:false, blankText: 'Ingrese su Clave' }], buttons: [{ text: 'Ingresar', visible: false, handler: function(){ if(fp.getForm().isValid()){ var sb = Ext.getCmp('form-statusbar'); sb.showBusy('Validando...'); fp.getEl().mask(); fp.getForm().submit({ url: 'fake.php', success: function(){ sb.setStatus({ text:'Validacion Completa::::Bienvenido...!', iconCls:'', clear: true }); fp.getEl().unmask(); var redirect = "../../Main2/index.php"; window.location = redirect; } }); } } },{ text: 'Cancelar', visible: false }] }); //Ext.getCmp('login').focus(); // El foco estara puesto en el campo id new Ext.Panel({ title: 'Ingrese Datos', renderTo: Ext.getBody(), width: 350, autoHeight: true, layout: 'fit', items: fp, bbar: new Ext.ux.StatusBar({ id: 'form-statusbar', defaultText: 'Ingrese Datos', plugins: new Ext.ux.ValidationStatus({form:'status-form'}) }) }); });
fake.php
Código PHP:
Ver original
<?php include "../../Conexion/cnx_php.php"; //obtenemos los valores de nuestro login $user = $_POST['Login']; $pass = $_POST['password']; $result = mssql_query("select [login],[password] from SRM_LOGIN where login= '$user' and password = '$pass'"); //Realiza la validacion de Usuarios if($row['Login'] == $user && $row['password'] == $pass){ echo "{success:true}"; }else{ //echo "{success:false, errors: { reason: 'Password error.' }}"; echo "{success:false}"; } ?>