PDA

View Full Version : this.form.el.dom is undefined



parky128
24 Nov 2010, 1:58 AM
Hi,

I am encountering errors when using a Form Panel within a Window component to submit data back to the server.

On the initial display of the Window, the form displays fine and I can enter in values and submit the data. If I close and open the Window again and submit new data once again, I then get the error


'this.form.el.dom is undefined' which is coming from line 44845 in ext-all-debug.js which I can see is in a getMethod() routine which

The actual submission of data still works and I get responses back from the server to confirm this. But I just don't get why I am seeing the error message.

Form Panel code...


Ext.ns('SBS.Websites.PP3');
SBS.Websites.PP3.UnitDetailsFormUi = Ext.extend(Ext.form.FormPanel, {
title: '',
height: 350,
padding: 10,
autoHeight: true,
id: 'formUnitDetails',
initComponent: function() {
this.items = [
{
xtype: 'textfield',
fieldLabel: 'Vehicle Name',
anchor: '95%',
name: 'UnitName',
width: 250,
id: 'fieldUnitName'
},
{
xtype: 'fieldset',
title: 'Vehicle Specifics',
layout: 'column',
cls: 'x-form-item',
itemCls: 'x-form-item',
items: [
{
xtype: 'panel',
title: '',
layout: 'form',
columnWidth: 0.5,
headerAsText: false,
border: false,
labelWidth: 50,
items: [
{
xtype: 'textfield',
fieldLabel: 'Make',
anchor: '95%',
name: 'Make'
},
{
xtype: 'textfield',
fieldLabel: 'Model',
anchor: '95%',
name: 'Model'
},
{
xtype: 'textfield',
fieldLabel: 'Colour',
anchor: '95%',
name: 'Colour'
}
]
},
{
xtype: 'panel',
title: '',
layout: 'form',
columnWidth: 0.5,
headerAsText: false,
border: false,
labelWidth: 75,
items: [
{
xtype: 'textfield',
fieldLabel: 'Vin',
anchor: '95%',
name: 'VINNo'
},
{
xtype: 'textfield',
fieldLabel: 'Livery',
anchor: '95%',
name: 'Livery'
},
{
xtype: 'textfield',
fieldLabel: 'Chassis No',
anchor: '95%',
name: 'ChassisNumber'
}
]
}
]
},
{
xtype: 'fieldset',
title: 'Display Icon',
ref: 'fieldSetDisplayIcon',
id: ''
},
{
xtype: 'hidden',
fieldLabel: 'Label',
anchor: '100%',
name: 'UntID',
ref: 'hidUntID'
}
];
SBS.Websites.PP3.UnitDetailsFormUi.superclass.initComponent.call(this);
}
});Window Code....



Ext.ns('SBS.Websites.PP3');
SBS.Websites.PP3.PlacemarkerDetailsWindowUi = Ext.extend(Ext.Window, {
title: '',
width: 500,
height: 400,
activeItem: 0,
autoHeight: true,
modal: true,
constrain: true,
iconCls: 'editdetails',
initComponent: function() {
this.items = [
{
xtype: 'placemarkerdetailsform'
}
];
this.bbar = {
xtype: 'toolbar',
items: [
{
xtype: 'tbfill'
},
{
xtype: 'button',
text: 'Create',
iconCls: 'create',
ref: '../btnPlacemarkerCreateNew'
},
{
xtype: 'button',
text: 'Save Changes',
iconCls: 'save',
ref: '../btnPlacemarkerDetailsSaveChanges',
id: ''
}
]
};
SBS.Websites.PP3.PlacemarkerDetailsWindowUi.superclass.initComponent.call(this);
}
});The actual submit code is...


createPlacemarker: function() {

this.getForm().submit({
url: 'Session/CreatePlacemarker',
waitMsg: 'Creating Placemarker...',
success: function(form, action) {

Ext.Msg.alert('Success', 'Placemarker has been added successfully');

this.appHub.PlacemarkerStore.loadData([action.result.data],true);


},
failure: function(form, action) {

Ext.Msg.alert('Failure', action.result.message);
},
scope:this
});
}

Can someone please assist?

Thanks,
Rob

Condor
24 Nov 2010, 2:05 AM
Are you hiding and reshowing the window or destroying and recreating it?

This could happen if you hide and recreate the window (so you actually have two windows).

parky128
24 Nov 2010, 2:22 AM
I am creating a new window every time like so


new SBS.Websites.PP3.PlacemarkerDetailsWindow({
LatLng : params.LatLng,
appHub: this.appHub,
title: 'Add a New Placemarker'
}).show();

But I thought the default closeAction on the Window component was 'close' so it should destroy the child form component when I close down the Window, am I correct in saying that?

Condor
24 Nov 2010, 2:30 AM
And after saving, how do you close the window? (or were you already closing it before the form was submitted?)

parky128
24 Nov 2010, 2:52 AM
Just by clicking the close button in the top right of the Window.

I have just been doing some more testing...

If I open and close the Window say three times, but dont actually do any form submissions, no errors are raised. On the 4th open, I submit some data and I get that error message three times.

So, this seems to suggest that the Window is being created multiple times. I just don't undertstand how, I am not storing a reference to the window and just hiding it, I am using the default close\destroy behaviour with that default close button in the top right of the window.

Odd!

Condor
24 Nov 2010, 4:01 AM
You can check the DOM. Does the window DOM exist 3 times (with 2 of them hidden)?

parky128
24 Nov 2010, 4:15 AM
No, I was hoping it would as at least that would explain what's going on but Firebug clearly shows the one instance of the window in the DOM, let me see if I can put this code somewhere live so you can see what I'm seeing...

Will post back again later