Hello !
I have design a subform with livecycle but I can't finish the last part.
I copy a subform and set presence for the button Add as invisible. But for the last subform if user press Remove, then it can not add another.
Want is my question: is it possible that when the last subform is revomed the presence for button Add from the subform before it to change it to visible ?
You can find the file here: http://www.filehost.ro/923317/RepeatingSubform_pdf
Thank you.
Views
Replies
Total Likes
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.
Paul
Views
Replies
Total Likes
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 ?
Views
Replies
Total Likes
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.
Paul
Views
Replies
Total Likes
I am sorry but I do not understand. Can you please send me a sample by email or post it here.
Thank you.
Views
Replies
Total Likes
Here you go ....I moved the add button outside of the subform, then I added code to the remove button to hide the 1st instance
paul
.
Views
Replies
Total Likes
Thank you, but it still does not help me.
Can you please tell me how to find, in javascript, the last copied subform ?
Views
Replies
Total Likes
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
Paul
Views
Replies
Total Likes
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)
{
_SubformX.instanceManager.removeInstance(this.parent.index);
xfa.form.recalculate(1);
xfa.layout.relayout();
}
Views
Replies
Total Likes
Are you getting any errors in the javscript console?
Paul
Views
Replies
Total Likes