I have a form which when selecting a checkbox on the first pg it automatically makes several Subforms in Section3 appear. In Section3 I have 11 subforms of which 2 are to be repeated (20 times). I hide all Section3 and all subform 1-11 in order to make the form smaller and only have the subforms the user needs appear when selecting a checkbox.
My problem is the following:
When hiding everything and than selecting SubForm 8 and 9 the repeat possibility does not enable itself. I can see the subform but I can use the +/- buttons of SubForm 7 and Subform 8
I tried hiding only the Section 3 but leaving the subForms (8 & 9) as visible and than it works, which is odd.
Anyone know how to solve this?
I'll attach the form to the documents for viewing.
I think I know why it's behaving like this...
Consider your Subform8 as an initial object, if it's hidden, any other instances created is based on the initial object of Subform8 will be hidden
if it's visible, any other instances created is based on the initial object of Subform8 will be visible
So because your initial object's presence is hidden, each time you add a new instance it creates the initial object as a new instance.
You would have to set each instances to visible when created if you want them visible.
you can do a loop through each instances to set them visible, or if you add instances using the addInstance(1); you can do the following
Hope this help!
Unfortunately this did not work completely.
Althought it did add a row below, the numbering was out of count and I could only view one row.
I am attaching my form to the documents area.
SF7 and SF8 are the ones with the repeating rows of SECTION3.
I inserted the script in "enter" even tried calculated.
You're help is greatly appreciated.
okay it works... thank you for yourn help... can you tell me how to reverse it?
var newRow = Subform8.instanceManager.removeInstance(1);
newRow.presence = "hidden";
the method addInstance returns the row added if you assign it to a value..
but when using removeInstance there is no return value because it removes the instance, so the instance is deleted
also when using removeInstance, you must specify the index you want to remove, do not just specify 1 because this will always delete the instance at 1 (second instance) because it's 0 based-index