Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

addInstance with hidden form

Avatar

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

Avatar

Avatar
Boost 1
Level 2
Luigi_247_365
Level 2

Likes

2 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 2
Luigi_247_365
Level 2

Likes

2 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Luigi_247_365
Level 2

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!

Avatar

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!

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.