PDA

View Full Version : Forms and ContentPanels



Lloyd K
7 Feb 2008, 2:13 AM
What is the correct way to add a form to a contentpanel? Currently I show a dialog with two contentpanels as tabs, these are generated like this:



this.generalPanel = new Ext.ContentPanel(Ext.id(),{
autoCreate: true,
title: "General",
closable: false
});
this.generalPanel.setContent('<div id="generalform"></div>');
this.dialog.layout.add("center",this.generalPanel);


I then create the form and render it to the panel:



this.generalForm = new Ext.form.Form({
labelAlign: "left",
labelWidth: 120
});

this.generalForm.fieldset({
legend: "Timezone"
},
new Ext.form.TextField({
fieldLabel: "Schedule Name",
name: 'schedule_name',
width: 400
}),
new Ext.form.Checkbox( {
fieldLabel: "Enabled",
name: "schedule_enabled",
width: 20,
checked: true
})
);
this.generalForm.end();

this.generalForm.render("generalform");


This sort of works however when I close the dialog and reopen it (even though it's a new instance) the form refuses to render.

Any help and pointers would be appreciated.