1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Answers
    1
    Vote Rating
    0
    lordzardeck is on a distinguished road

      0  

    Default Answered: extjs adding additional field to dynamic forms (get field index)

    Answered: extjs adding additional field to dynamic forms (get field index)


    I need to allow my users to submit multiple property addresses by clicking a button that will insert a fieldset with extra text fields. I can do this simply with form.insert(index, component); However, that index will change after the user adds an additional property. For example, the index to add the extra properties is after the 7th component, making the index 7. But when you insert it at 7, it's index is now 7 and the next property will be inserted above it. This effect is further compounded when you try to do this with contact emails and numbers in the same form. So my question is, how can I get the index of the component in the form that I wish to insert the extra fields after?

  2. Actually no, as I said i needed it in a specific place. I actually did figure it out, and it turned out to be quite simple. All I did was create a blank generic container and add it in the place where I wanted to add my extra form fields. Then I just had to add the form fields to that container with the add() method.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Answers
    3542
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you just want to add it to the end? If so then you can use add() instead of insert()
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Answers
    1
    Vote Rating
    0
    lordzardeck is on a distinguished road

      0  

    Default


    Actually no, as I said i needed it in a specific place. I actually did figure it out, and it turned out to be quite simple. All I did was create a blank generic container and add it in the place where I wanted to add my extra form fields. Then I just had to add the form fields to that container with the add() method.

Thread Participants: 1

Tags for this Thread