Highlighted

addInstance with hidden form

Avatar

Guest

25-11-2008

I have a form (FormHidden) that is a hidden form when the pdf loads. I have a checkbox that can be checked to make the form visible. The code on this checkbox is:



if (this.rawValue == "1"){

xfa.form.form1.MainPage.FormHidden.presence = "visible";

} else {

xfa.form.form1.MainPage.FormHidden.presence = "hidden";

}



Once this checkbox is checked the FormHidden appears with the various text entries. I then have another button called Add Source that is supposed to add another instance of the FormHidden form. The code for this button is:



xfa.resolveNode("form1.MainPage.FormHidden").instanceManager.addInstance(1);

xfa.form.recalculate(1);



The problem I am having is that when I push the button if I have the form hidden initially it will not add another instance of the FormHidden. The Add Source button works fine if I make the form visible to begin with. It is something to do with having it hidden at first that makes it so it will not generate another instance. Any help would be wonderful. Thanks in advance!

Replies

Highlighted

Luigi_247_365

26-11-2008

By design: instanceManager.addInstance(1); adds the original state of that component!



Therefore:

The reason is that the new instance is also hidden - Make it visible!
Highlighted

Avatar

Guest

26-11-2008

Thank you for your response Luigi. If Luigi or anyone else has any ideas on how I can make these subsequent instances of the subform visible while still leaving the first one hidden until the button is clicked that would be great. I am not sure what the code would be for something like that. Do I need to be using other than the addinstance to be able to do this? Thanks!
Highlighted

pguerett

26-11-2008

The issue is that when the subform is hidden it is not part of the layout and as such is not an addressable object. When you call the instanceManager there is no object there. To alleviate this we added a syntax of _subformName that will address objects that are not part of the layout. So try this syntax instead.



form1.MainPage._FormHidden.addInstance(1);



Note that you do not need the xfa.resolveNode syntax in these expressions.