fatnjazzy
fatnjazzy

Reputation: 6152

Extjs form - findField is not defined

I am selecting a form in Extjs as the following:

var form = Ext.getCmp(mainTabsId).getActiveTab().down().getForm("add-form");
//I am getting here the correct id.
console.log(form.id);

But when I am trying to find a field inside like that I am getting the following error:

form.findField("Address").getValue();

Uncaught TypeError: Object [object Object] has no method 'findField' 

this is the console.log of form http://pastebin.com/EuVizyCZ

Upvotes: 0

Views: 5395

Answers (1)

rixo
rixo

Reputation: 25001

findField is a method of Ext.form.Basic, not Ext.form.Panel... So you have to do:

form.getForm() // get the BasicForm ref
    .findField('Address')
    .getValue();

Update

By guessing from your code, I would try:

// supposing add-form is the id or itemId of a FormPanel
Ext.getCmp(mainTabsId).getActiveTab().down('#add-form').getForm()

Upvotes: 4

Related Questions