PDA

View Full Version : submission of form data



TheMonolith
12 Mar 2010, 2:37 AM
My form structure looks like this:



mainPanel
positionFieldSet
5 buttons (toggle group)
textFieldSet
combobox
textField
fontFieldSet
combobox
2 checkboxes
fontColorFieldSet
formPanel
numberField
formPanel
numberField
formPanel
numberField
backgroundColorFieldSet
formPanel
numberField
formPanel
numberField
formPanel
numberFieldPut into a sentence, mainPanel contains 5 fieldSets, each of which contains several components. Indentation indicates nesting.

Now I want mainPanel to submit all the form data. As far as I understand from reading the "Forms" chapter in the "Learning Ext JS book" and looking at old threads, the components whose data I want to submit must be contained in a FormPanel.

My questions is: Must these components be directly contained in a FormPanel or is it sufficient if they are indirectly contained, as in the following version:



mainFormPanel
positionFieldSet
5 buttons (toggle group)
textFieldSet
combobox
textField
fontFieldSet
combobox
2 checkboxes
fontColorFieldSet
formPanel
numberField
formPanel
numberField
formPanel
numberField
backgroundColorFieldSet
formPanel
numberField
formPanel
numberField
formPanel
numberFieldThank you for your help!

Animal
12 Mar 2010, 2:42 AM
The second version is the only solution the way things are set up now.

Submission values are pulled directly from the DOM of the FormPanel.

I can foresee a better method of submission which uses the Ext Container hierarchy to extract field values to submit, but this is where we are at now.

TheMonolith
12 Mar 2010, 3:07 AM
So all components must be contained in a FormPanel, but it is sufficient if they are indirectly contained (as in my second example)?

Animal
12 Mar 2010, 3:35 AM
They are still inside it.

VinylFox
12 Mar 2010, 1:26 PM
By the way, you don't have to use FormPanel's for each of the nested sections, you can just set the layout to 'form' on a standard Panel. So to use your example...


mainFormPanel
positionFieldSet
5 buttons (toggle group)
textFieldSet
combobox
textField
fontFieldSet
combobox
2 checkboxes
fontColorFieldSet
Panel (layout: 'form')
numberField
Panel (layout: 'form')
numberField
Panel (layout: 'form')
numberField
backgroundColorFieldSet
Panel (layout: 'form')
numberField
Panel (layout: 'form')
numberField
Panel (layout: 'form')
numberField

Animal
13 Mar 2010, 1:54 AM
or simpler:



mainFormPanel
positionFieldSet
5 buttons (toggle group)
textFieldSet
combobox
textField
fontFieldSet
combobox
2 checkboxes
fontColorFieldSet
numberField
numberField
numberField
backgroundColorFieldSet
numberField
numberField
numberField


No need to wrap every Field inside a (very heavyweight) Panel. Panel is a very complex class.