les comparto el codigo esperando su apoyo.
Código Javascript:
Ver original
Ext.onReady(function(){ Ext.QuickTips.init(); // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var bd = Ext.getBody(); var simple = new Ext.FormPanel({ frame: true, title:'Registrar Usuario', width:400, autoHeight:true, url:'save-form.php', waitMsgTarget: true, monitorValid:true, items:[{ labelAlign: 'left', labelWidth: 125, items: [ new Ext.form.FieldSet({ title: 'Detalles de Registro', autoHeight: true, defaultType: 'textfield', items: [{ fieldLabel: 'User', name: 'user', width:90, allowBlank:false },{ fieldLabel: 'Password', name: 'passwd', inputType:'password', width:90, allowBlank:false },{ fieldLabel: 'Area', name: 'area', width:190, allowBlank:false },{ fieldLabel: 'Nombre', name: 'nombre', width:190, allowBlank:false },{ fieldLabel: 'Ap. Paterno', name: 'apellidop', width:190, allowBlank:false },{ fieldLabel: 'Ap. Materno', name: 'apellidom', width:190, allowBlank:false },{ fieldLabel: 'Oficina', name: 'oficina', width:190, allowBlank:false },{ fieldLabel: 'Referencia', name: 'referencia', width:190, allowBlank:false }, new Ext.form.ComboBox({ fieldLabel: 'Tipo', name:'tipo', store: new Ext.data.ArrayStore({ fields: ['numero', 'detalle'], data : [ ['1','ADMIN'], ['2','USER']] }), valueField:'numero', displayField:'detalle', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'Elija el Tipo de Usuario...', selectOnFocus:true, width:190, allowBlank:false }),{ fieldLabel: 'E-mail', name: 'email', vtype:'email', width:190, allowBlank:false }] }) ] }], buttons: [{ text: 'Registrar', formBind: true, // Function that fires when user clicks the button handler:function(){ simple.getForm().submit({ method:'POST', waitTitle:'Conectando', waitMsg:'Enviando Data...', success:function(){ Ext.Msg.alert('Exito', 'Registro Exitoso!', function(btn, text){ if (btn == 'ok'){ var redirect = 'index.php'; //url luego de registrar usuario window.location = redirect; } }); }, failure:function(form, action){ if(action.failureType == 'server'){ obj = Ext.util.JSON.decode(action.response.responseText); Ext.Msg.alert('Registro Fallido!', obj.errors.reason); }else{ Ext.Msg.alert('Error!', 'Autenticacion con el Servidor Rechazada : ' + action.response.responseText); } simple.getForm().reset(); } }); } },{ text: 'Cancelar', handler: function(){ Ext.Msg.alert('Advertencia', 'Esta Seguro de Eliminar los Datos Ingresados?', function(btn, text){ if (btn == 'ok'){ simple.getForm().reset(); } }); } }] }); simple.render('mant'); });