PDA

View Full Version : how to ADD a new 'Client' form in the same FORM??



germana
8 Apr 2008, 12:32 PM
Hi!!!

I need to ADD a new client Form when the user click the 'Agregar Cliente' button in the Client form, just next (down) to the other

This is my code:


Ext.onReady(function(){

Ext.QuickTips.init();

// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';

var store = new Ext.data.SimpleStore({ //Para hacer el Combo de Estatu
fields:['status'],
data:[['activo'],['retirado']]
})

var bd = Ext.getBody();

/*
* ================ Formulario de Empresa/Cliente =======================
*/

var tabs = new Ext.FormPanel({
labelWidth: 95,
border:false,
width: 'auto',
bodyStyle:'margin:10px',

items: {
xtype:'tabpanel',
activeTab: 0,
defaults:{autoHeight:true, bodyStyle:'padding:10px', autoWidth:true},
items:[{
title:'Empresa/Negocio',
layout:'form',
defaults: {width:230},
defaultType: 'textfield',

items: [{
fieldLabel: 'Nombre',
name: 'name',
allowBlank:true,
value: '',
width:'400'
},{
fieldLabel: 'RIF',
name: 'rif',
value: 'J-'
},{
fieldLabel: 'Telefono',
name: 'phone',
value: '',
vtype:'alphanum'
}, {
fieldLabel: 'Fax',
name: 'fax',
value:'',
vtype:'alphanum'
}, {
fieldLabel: 'Pagina Web',
name: 'web',
value:'',
vtype:'url'
},{
fieldLabel:'Email',
name: 'email',
vtype:'email'
},{
fieldLabel:'Estado',
name: 'state',
value:'Carabobo',
vtype:'alpha'
},{
fieldLabel:'Ciudad',
name:'city',
value:'Tocuyito',
vtype:'alpha'
},{
fieldLabel:'Direccion',
name:'address',
value:'',
width:550
},{
fieldLabel:'Notas',
name:'note',
value:'',
width:550
}]
},{
title:'Clientes',
layout:'form',
defaults: {width: 230},
defaultType: 'textfield',
width:'auto',
buttons:[{
text:'Agregar cliente'
}],

items: [{
xtype:'combo',
store:store,
fieldLabel:'Estatus',
name:'status',
displayField:'status',
mode:'local',
triggerAction:'all',
forceSelection:true,
editable:false,
emptyText:'-Seleccione-',
width:100
},{
fieldLabel: 'Nombre/Apellido',
name: 'name',
value: '',
vtype:'alpha'
},{
fieldLabel: 'Cedula',
name: 'ci',
vtype:'alphanum'
},{
fieldLabel: 'Celular',
name: 'mobile',
vtype:'alphanum'
},{
fieldLabel: 'Email',
name: 'email',
vtype:'email'
},{
fieldLabel:'Cargo',
name:'job',
vtype:'alphanum'
},{
fieldLabel:'Notas',
name:'note',
width:550
}]
}]
},

buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});

tabs.render(document.body);

});

OutpostMM
8 Apr 2008, 12:59 PM
Please edit your post or post your code again inside of a code box, it's not easy to see the structure of the code with all of the indenting removed. Also, keep in mind that with HTML you cannot embed one form in another one. I'm not sure if you're trying to put one form in another one or add a whole new form, but you can't put one form inside another one.

germana
9 Apr 2008, 4:17 AM
Please edit your post or post your code again inside of a code box, it's not easy to see the structure of the code with all of the indenting removed. Also, keep in mind that with HTML you cannot embed one form in another one. I'm not sure if you're trying to put one form in another one or add a whole new form, but you can't put one form inside another one.

I want to ADD a whole new form just down to the old one........

OutpostMM
9 Apr 2008, 8:54 AM
Set up a container like a panel or viewport inside the body and add your forms to that instead of rendering to the body. You can put a listener on your button to run a function that will set up a new formpanel and add it to the form container. Just make sure that your container does not have a "fit" layout or else it will only show the first formpanel.

germana
9 Apr 2008, 9:09 AM
Sorry... but i got a new petition........

how colud i create a new 'label' Clientes into the PanelForm ????

Thanks!!!