-
2 Jun 2012 2:56 PM #1
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?
-
Best Answer Posted by lordzardeck
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.
-
7 Jun 2012 1:17 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Jun 2012 1:46 PM #3
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.


Reply With Quote