PDA

View Full Version : Form findField and Internet Explorer error



anand.patel
18 Apr 2012, 2:13 AM
Hello all -

I am running into a weird issue. I am relatively new to ExtJS. The below snippet works in all browsers except IE 8- and I have no idea why.

In my form



...
{
xtype: 'textfield',
name: 'fname',
fieldLabel: 'First Name',
labelAlign: 'top',
allowBlank: false,
x: 10,
y: 60,
listeners: {
change: {
fn: me.onNameChange,
scope: me
}
}
},
{
xtype: 'textfield',
name: 'mname',
fieldLabel: 'Middle Name',
labelAlign: 'top',
x: 170,
y: 60,
listeners: {
change: {
fn: me.onNameChange,
scope: me
}
}
},
{
xtype: 'textfield',
name: 'lname',
fieldLabel: 'Last Name',
labelAlign: 'top',
allowBlank: false,
x: 330,
y: 60,
listeners: {
change: {
fn: me.onNameChange,
scope: me
}
}
},


and the listener for the change event...



onNameChange: function(field, newValue, oldValue, options) {
myform = Ext.getCmp('MainForm').getForm(); //snags the BasicForm object

fname = myform.findField('fname').getValue(); // get name values
mname = myform.findField('mname').getValue();
lname = myform.findField('lname').getValue();
...
}


With IEs AMAZING debugging tools, I inspected the myform in the function, and findField() is listed in the [Methods] - however, I still get an 'Object doesn't support this property of method' Line: 10658 Char: 25 in ext-all-debug.js

Is there something I am doing wrong. I thought I needed to get the BasicForm by using getForm(). findField( id, name, or hiddenName) - i used name. then getValue().

Can someone point me in the correct direction. I used JavaScriptLink (http://www.javascriptlint.com/) thinking it was a trailing comma issue somewhere, but it did not find any. I am using ExtJS 4.1.0.7.

anand.patel
18 Apr 2012, 2:28 AM
ignore.. found this issue, not sure if its correct, but placing 'var' in front of it seems to work....



onNameChange: function(field, newValue, oldValue, options) {
var myform = Ext.getCmp('MainForm').getForm(); //snags the BasicForm object

var fname = myform.findField('fname').getValue(); // get name values
var mname = myform.findField('mname').getValue();
var lname = myform.findField('lname').getValue();
...}