tags:

views:

1055

answers:

1

I'm trying to build modal windows on the fly from single javascript object passed by server. But I have no clue how can I serialize form inside modal window without defining form variable . In most examples serialize process look like this:

//create form
var CustomForm = new Ext.FormPanel({...});
//submiting form
CustomForm.getForm().submit({...});

In my case all inner components like "form" are created from xtype value,and no variable is assigned to it. Is there any way to select and serialize form using something like this:

Ext.get(this).select('form').serialize();

or what is apropriate way of doing so?

+1  A: 

You can assign the form an id and use Ext.getCmp(formid).

To retrieve the form values of a FormPanel use myFormPanel.getForm().getValues()

That will come back with a js object representing the form fields.

ifwdev
Thanks it is working now, how ever is it possible to select parent form using pressed button as refference?
Nazariy
Use myButton.findParentByType('form')
ifwdev