Best practice: 1 form with dynamic content or submit 2 forms at once?
Best practice: 1 form with dynamic content or submit 2 forms at once?
Hello,
I am writing an application in wich I must be able to add components with their configuration to some objects.
All components have a common part (id, name, position,...) and a component type specific configuration which is stored in component specific database tables.
I want to create a window with a form for the complete component. The user should enter the common data and use a combobox to select the type of the component which should display the type specific part of the form.
I read the forum and as far as I understand adding/removing fields from a form seems to be no good idea. By the way it could be that I have the same field names in the component-specific forms.
Placing the information in fieldsets and using enable/disable + hide/show does not work either because the validation of the form works on the disabled fields, too - so if the user does not enter information for a specific component type the form will not be submitted.
Currently I am thinking about using several forms:
One for the common part
One for each component type (using a card-layout to only show the selected form)
I could use a submit button to start the validation of both forms and then retrieve the values and submit them by JSON....
Has anybody tried to do this?
What are the problems to expect?
and
street_address_street
street_address_suburb
street_address_postcode
etc...
then when you submit the form each section's data can be picked up by the logic in your server-side code.
you can easily add fields to the form before rendering (or after for that matter)... and if you put them in a group of objects to add/remove, then it makes it easier, you could submit multiple forms, but this IMHO complicates things.
Check out SenchaWorld.com for articles, screencasts, conference videos and more.