Highlighted

Hidden addInstance

Avatar

Guest

04-11-2008

I have a repeating subform that is a full page. I want it initially to be hidden and only called when needed.



I have created a 2 buttons on the repeating subform

Add Form

form1.Subform1.instanceManager.addInstance(1);

xfa.form.recalculate(1);



Delete Form

form1.Subfrom1.instanceManager.removeInstance(this.parent.parent.index);



The initial instance is called from another page. This is the script for that Add Form button:

form1.Subform1.instanceManager.addInstance(1);

xfa.form.recalculate(1);



I have also tried adding this line:

form1.Subform1.presence="visible";



If I set the subform to visible with a Minimum Count of 1, the repeating subform works.



If I set the subform to visible with an Initial Count of 0, the repeating subform does not work.



If I set the subform to hidden with a Minimum Count of 1, the repeating subform does not work.



Im stumped and dont know which way to turn. Any help would be appreciated.



Thanks

Carol

Replies

Highlighted

Avatar

Guest

26-11-2008

Hi,

Presumably you don't need to set the subform to "hidden" if you also have a min count of 0. No instances will be created until your button is clicked (on some other page) that does form1.Subform1.instanceManager.addInstance(1);



Setting the subform visible should do the trick, if you choose to initially set it to hidden. Your script to show the subform was:

form1.Subform1.presence = "visible";

That script is only going to set the first instance of the subform to visible; it's equivalent to Subform1[0].presence = "visible"; You may need to update your script to use the index of the instance of the subform that you just added. (Still, I think in this case you don't really need to set the subform to hidden, to begin with).



Note that you only need to call recalculate() if you're targetting older versions of Acrobat; maybe earlier than 7.1?



I posted some (hopefully useful) information on this topic on a blog that i recommend you read:

http://blogs.adobe.com/lcdesigner/

See the "Script dependencies and "recalculate()" blog - which does get a little heavy as an article, but there's some good stuff in there.



If that doesn't help, please respond with more detail; I'm not sure what you mean by "does not work" in your last 3 lines; do you mean that the subform doesn't get created? or that it isn't visible?



Mike