PDA

View Full Version : fp.getForm().load getting error



CrazyFluger
30 Jan 2008, 12:57 PM
var fs = new Ext.form.FieldSet({
title: 'Parameters',
autoHeight: true,
defaultType: 'textfield',
items: [
{ fieldLabel: 'field1', name: 'title', width:190 },
{ fieldLabel: 'field2', name: 'module', width:190 },
{ fieldLabel: 'field3', name: 'method', width:190 },
{ fieldLabel: 'field4', name: 'params', width:190 },
{ fieldLabel: 'field5', name: 'icon', width:190 }
]
});
var fp = new Ext.FormPanel({
title: 'New item',
closable: true,
frame: true,
labelAlign: 'right',
labelWidth: 100,
width: 340,
waitMsgTarget: true,
// configure how to read the XML Data
reader: new Ext.data.XmlReader(
{ record: 'item', success: '@success' },
[ 'title', 'module', 'method', 'params', 'icon' ]
),
items: [ fs ]
});

// explicit add
fp.addButton({
text: 'Submit',
handler: function(){
//fs.getForm().submit({url:'xml-errors.xml', waitMsg:'Saving...'});
}
});

var tab = this.tabs.add(fp);
this.tabs.activate(tab);
fp.doLayout();

// load form data
fp.getForm().load({ url: '?x=y&z=y', waitMsg: 'Loading...' });


after fp.getForm().load() function I had next error

(this.options.method || this.form.method || this.form.el.dom.method || "POST").toUpperCase is not a function
http://new.cms/admin/js/ext-all.js
Line 138

What`s wrong?

CrazyFluger
3 Feb 2008, 3:46 AM
When I was look to firebug, I fund that this construction (this.options.method || this.form.method || this.form.el.dom.method || 'POST') return my field in form, because it hase name 'method'. After field was renamed, the problem is gone.

halkon_polako
3 Feb 2008, 3:58 AM
:D Wow..this is a funny one!!...
I never thought about the name of a field in a form could be problematic in this context. Good to know ... and remember!!