Hello,
I have a button which makes a subform visible. That is working fine.
I'd like the button when clicked a second time to add another instance of the same subform. Is this possible? I have no idea how to begin with the JavaScript for this and would appreciate help.
Thanks in advance,
MDawn
Solved! Go to Solution.
Views
Replies
Total Likes
Instead of making the subform visible and then adding instances you can do it just using instances then the button is doing the same thing.
To "hide" the subform using instances, make sure under Binding that the Min Count is clicked off and the Inititial Count is set to 0 (zero) - your subform will now be hidden by default.
Change the code you have showing the subform to use addInstance() instead of presence, using the underscore shortcut for the Instance Manager (you have to use the underscore method because the instance doesn't exist yet):
_hiddenSubform.addInstance(true);
If you remove instances back to zero then the subform will go away again. Doing it this way also has the advantage of resetting all the data in the subform.
Views
Replies
Total Likes
Instead of making the subform visible and then adding instances you can do it just using instances then the button is doing the same thing.
To "hide" the subform using instances, make sure under Binding that the Min Count is clicked off and the Inititial Count is set to 0 (zero) - your subform will now be hidden by default.
Change the code you have showing the subform to use addInstance() instead of presence, using the underscore shortcut for the Instance Manager (you have to use the underscore method because the instance doesn't exist yet):
_hiddenSubform.addInstance(true);
If you remove instances back to zero then the subform will go away again. Doing it this way also has the advantage of resetting all the data in the subform.
Views
Replies
Total Likes
Thank you. This worked great.
Views
Replies
Total Likes