PDA

View Full Version : 2 forms 1 submit



Stephan123
30 Oct 2009, 2:57 AM
Hello !

I have build an window with hbox. In this window are
3 'hbox' . In the first and the second hbox there are form elements.
When i load the forms or submit the forms i must 2 operation call.
Is there a better way ?


var fenster = new Ext.Window({
layout: 'hbox',
height: 300,
width: 800,
title: "Fenster mit 'form' - Layout und HBox",
bodyStyle: 'padding: 10px;background-color: #ffffff;',
id: 'fenster',
layoutConfig: {
pack: 'start'
},
defaults: {
frame: false,
padding: '10',
margins: '5 5 5 5'
},
items: [{
title: 'Panel 1',
height: 200,
width: 200,
layout: 'form',
defaultType: 'field',
id: 'abschnitt1',
xtype: 'form',
items: [{
fieldLabel: '11',
width: 50,
name: '11'
},{
fieldLabel: '12',
width: 50,
name: '12'
}]
},{
title: 'Panel 2',
height: 200,
width: 200,
layout: 'form',
defaultType: 'field',
id: 'abschnitt2',
xtype: 'form',
items: [{
fieldLabel: '21',
width: 50,
name: '21'
},{
fieldLabel: '22',
width: 50,
name: '22'
}]
},{
title: 'Panel 3',
height: 200,
width: 200,
html: 'Box 3'
}]
}).show();Your sincerly

Stephan

catapult
30 Oct 2009, 3:14 AM
I think you could wrap the two panels in a single form.
e.g.



xtype : 'form',
id : 'myForm',
items : [
{
xtype : 'panel',
id : 'firstPanel'
items : {}
},
{
xtype : 'panel',
id : 'firstPanel'
items : {}
}]


I believe this way when you submit the form you will submit the data from both panels.

Animal
30 Oct 2009, 3:19 AM
Of course the form would be



layout: {
type: 'hbox',
align: 'stretch'
}


And obviously, your window would be layout: 'fit', and be SIZED.

Animal
30 Oct 2009, 3:19 AM
And those two don't need to be Panels unless you want Panel capabilities.