View Full Version : Formpanel this.body is null when rendering to a div

9 Nov 2010, 7:48 AM

I have the following code and a simple page with a single div. I call the function passing the div name. I'm expecting the form to render inside the div. When I run the following I get an error when it's trying to initEl. It's being passed this.body which is null. When i try and render it to document.body it works fine.

function ManageClientForm(cmpId) {

var form = new Ext.FormPanel({
title: 'This is the form title',
items: [new Ext.form.TextField({
name: 'Name',
id: 'fieldid'

// form.render(document.body);

Best regards

David Reynolds

9 Nov 2010, 8:10 AM
cmpId can be:
1. The <div> id
2. The <div> HTMLElement
3. The <div> Ext.Element
but the <div> name is not supported.

(and you can only render after Ext.onReady)

9 Nov 2010, 8:15 AM
Thanks for the quick reply. Sorry my mistake for not being accurate. I meant div id not name. The code is running onReady.

Ext.onReady(function () {




9 Nov 2010, 8:40 AM
I've been doing some more testing. I currently have the div inside an html "form" tag. If I remove the form it works fine. The problem with this is that I need to include the form panel in an aspx page which will have a form tag with runat="server".

Any help would be greatly appreciated.

9 Nov 2010, 9:06 AM
You cannot have nested form tags. It's not valid HTML. You can use an Ext.Panel with layout: 'form' within a form tag if you wish to keep the same layout as a Ext.FormPanel.

11 Nov 2010, 11:06 AM
Ok. So EXT is pretty incompatibale with asp.net. If I go with a panel with a form layout how do I then post the values to the server. How do I spoof the formpanel.form.submit?