Results 1 to 2 of 2

Thread: Best practice: 1 form with dynamic content or submit 2 forms at once?

  1. #1
    Ext User
    Join Date
    Oct 2008
    Vote Rating

    Question Best practice: 1 form with dynamic content or submit 2 forms at once?


    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?

  2. #2
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Melbourne, Australia (aka GMT+10)
    Vote Rating


    when you add/hide extra fields you should also add/remove the validators for those fields so that this doesn't become an issue.

    You'll also want to make sure you don't end up with duplicate field names. This can be overcome by using prefixes for each 'type' of field group eg:

    group = postaladdress, prefix = 'postal'
    group = streetaddress, prefix = 'street'




    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.
    Lead Trainer / Sencha Specialist
    Community And Learning Systems

    Lead Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts