I am not sure I understand your question, but if you are trying to remove the last subform then you cannot with the way you have it setup. If you highlight the data subform in the hierrachy view, then look at the Object/Binding palette you will see that the min number of occurances is set to 1 hence you must always have at least one subform. If you change this value to 0 then you can remove the last one.
Thank you for your answer, but this is not my question.
If you check the file that I uploaded to that site (I also send it to you by email) you can see that when you click Add a new subform is added and for the previous subform Add button becomes invisible. The problem is that when you remove the last copied subform, the user does not have a visible Add button.
For example: I copy the first subform 5 times. For the first 4 subforms Add button is invisible and for the 5th subform is visible.
If I remove the 5th subform, then I can not Add another subform because there is no Add button.
What to I want: When I remove the 5th subform, the button Add to become visible for the 4th subform;
If I remove the 4th subform, the button Add to become visible for the 3th subform. And so on ...
Is it possible ?
Why not move the Add button outside of the subform then you would only have one add button and it woudl never disappear.
But if you insist on having the Add button as part of the data subform subform that you are removing then you could do something like this. You woudl have to restructure your form so that the buttons where in a subform on its own and the rest woudl be in another subform. Then when you got to the last data subform you woudl remove the subform that does not have the button in it.
I am sorry but I do not understand. Can you please send me a sample by email or post it here.
Thank you, but it still does not help me.
If you get the subform count then you know the index of the last subform. Or if you are executing from within the subform the you can use this.parent.index
Thank you. I think I solve it.
One more question. Can you please tell me for bellow code, why if the user click Yes, does not delete the subform?
var choice = xfa.host.messageBox("Delete?", "Delete", 2, 1);
if (choice == 1)
Are you getting any errors in the javscript console?