1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    3
    Vote Rating
    0
    gossi74 is on a distinguished road

      0  

    Question 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?

  2. #2
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,071
    Vote Rating
    40
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    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'

    fields:

    postal_address_street
    postal_address_suburb
    postal_address_postcode
    etc

    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.
    Senior Technical Training & Mentoring

    Teahouse Training Company
    Asia Pacific Region (Official Certified Sencha Trainer)

    Check out SenchaWorld.com - The best bits from the Sencha community (videos, blogs, etc)

    Code Validation : JSLint | JSONLint | JSONPLint

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar