PDA

View Full Version : Please Help "Ext.getCmp("basicinfoform").getForm is not a function" error message



bensmurfy
21 Apr 2010, 7:49 AM
Hi All,

I have looked at similar questions to mine, but didn't see how they might apply. Please find my code below. I would really appreciate any light you can shed on my issue.


Ext.onReady(function ()
{

var tabs = new Ext.TabPanel(
{
renderTo: 'tabcontainer',
activeTab: 0,
items: [
{
title: 'Basic Info',
frame: true,
id: 'basicinfoform',
autoHeight: true,
items: [
{
xtype: 'panel',
frame: false,
bodyStyle: 'margin:5px',
html: '<h2 align="center">Basic Provider Information</h2>'}],
listeners: {
activate: function ()
{
Ext.getCmp('basicinfoform').getForm().load(
{
url: 'ajx/formloader2.php',
waitMsg: 'Loading',
params: {
id: id
}
});
} // end active
} //end-listeners
}]});
});

Animal
21 Apr 2010, 7:56 AM
What kind of a Component do you think "basicinfoform" is?

diablo
21 Apr 2010, 8:02 AM
LE: Ext.getCmp('basicinfoform') returns a Panel back i suppose because is in a TabPanel and does not support getForm() method.

It seems that you have two components with the same id, if the 'basicinfoform' is defined also in another js file and it is in the same scope.

bensmurfy
21 Apr 2010, 8:08 AM
Yes, "basicinfoform", is a Panel defined in a separate js file. I'll look around for other methods to call it.

bensmurfy
21 Apr 2010, 9:08 AM
Ok, so from the previous code I added added a call to a defined function from a separate js file. The function createBasicForm. I'm trying to call this function in my code, but I think my method for calling it must be flawed. Please find my code below:


Ext.onReady(function ()


{ var tabs = new Ext.TabPanel(
{
renderTo: 'tabcontainer',
activeTab: 0,

items: [
{
title: 'Basic Info',
frame: true,
id: 'basicinfoform',
autoHeight: true,
items: [
{
xtype: 'panel',
frame: false,
bodyStyle: 'margin:5px',
html: '<h2 align="center">Basic Provider Information</h2>'}
function ()
createBasicForm()
]

listeners: {
activate: function ()
{
Ext.getCmp('basicinfoform').getForm().load(
{
url: 'ajx/formloader2.php',
waitMsg: 'Loading',
params: {
id: id
}
});
} // end active
} //end-listeners
}]});
});

fay
21 Apr 2010, 10:04 AM
Read your code. getForm() is a FormPanel method; Ext.getCmp('basicinfoform') does not return a component that is a form!!

CrazyEnigma
21 Apr 2010, 10:06 AM
getForm() must be a method of the object you are getting, but isn't, therefore the error. This means that the object (Panel) does not have the method getForm().

If your "basicinfoform" is a FormPanel, then maybe you might be able to access the getForm() method.

Avoid, using "id" at all costs, unless you know that this object is a Singleton.