PDA

View Full Version : [CLOSED] Adding submit button to FormPanel challenge



gatherworks
2 Mar 2012, 1:04 AM
There seems to be no way to properly add a cancel and submit button to a form panel. When adding buttons, they are added to the items list. However, I cannot find a way to add buttons to the button list. This causes a layout challenge and simply does not look right when looking at the form.

"items": [
{
"xtype": "button",
"text": "MyButton"
}

instead of:
// Reset and Submit buttons
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true, //only enabled once the form is valid
disabled: true,
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}],

aconran
2 Mar 2012, 9:23 AM
Add a toolbar to your panel
Set dock to bottom
Set ui of toolbar to 'footer'
Add Submit and Cancel buttons

gatherworks
2 Mar 2012, 10:43 AM
That works - thanks!