View Full Version : Ext.Ajax.request({form: ..}) parameter

8 Mar 2009, 8:58 AM
Is there any special usage for the form parameter in ajax call?
I have form with id = myForm and trying to make a ajax call:

url: 'test.php',
form: 'myForm',
params: {cmd:'myCommand'},
callback: handleCallback

I get "f.elements" is not defined.

f.elements is undefined
apply()()ext-base.js (line 1)
DomHelper()(Object url=modules/M1/controller.php)ext-all.js (line 9)
packSave()cc.js (line 841)
onButtonClick(Object initialConfig=Object id=save tooltip=Shrani)cc.js (line 817)
DomHelper()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all.js (line 9)
DomHelper()()ext-all.js (line 9)
apply()()ext-base.js (line 1)
[Break on this error] Ext={version:"2.2.1"};window["undefined"...setAttribute.call(this,h,k,j)}}})()})();

8 Mar 2009, 9:01 AM
Err, have you attempted to debug? At all? Like looking at the stacktrace?

8 Mar 2009, 9:45 AM

9 Mar 2009, 1:40 AM
Ok, I have found where my problem was.

Ajax request form parameter requires an ID of the dom form.
I didn't pay attention that specifying an ID to the ext form really sets an ID for the form's wrapping container. Analyzing html reviled that basic form had auto-generated ID.

Adjusting ajax form parameter to be:

params: Ext.getCmp('myForm').getForm().id

solved the case.

I am sorry that this was not that obvious to me and don't know how it is with others, but maybe form serializer could take extra step to automaticaly pick-up dom form if ext form id is passed.