I have a form that has a table inside of a subform which I've added a button to add additional instances of the subform containing the table. The add instance button is working fine, however, I also have a button to delete the current instance of the subform containing the table, and it isn't working right. It keeps removing the first instance of the subform rather than the current instance. For example, lets say the first table is for ordering product A, then the user can add another instance of the table to order product B, and then add a third table to order product C. So, lets say the user doesn't need the second table (product B) for whatever reason, so they click the delete table button in the second table, but instead of removing the second table containing product B, it removes the first table which contains product A.
I have the subform (OrderMain) set to repeat with a minimum count of 1. The button to add an instance of the OrderMain subform contains the following code:
I've tried adjusting the parent index but that hasn't worked. I also put code in the delete table button to show a message box containing the current parent index and every instance returns a parent index of 0. I'm using Adobe Acrobat XI to test the form. What am I doing wrong here?
Got it. Ended up checking the relative path of the remove button to the OrderMain subform. Since the remove button is in a different subform, I needed to take that into account when determining the index of the repeatable OrderMain subform. Since each "parent" refers to another subform, I changed the delete button code to the following: