I've got a doc with an image on it, and form objects (check boxes and text fields) on top. There are several pages of this, and each page is unique and premade.
I would like to make buttons on the first page that would show/hide the other pages, so the user could have just the 1st and the 5th page, for example.
My thought was to have all the pages present, but hidden by default. Then if the user required a page they could click a button and all the script would have to do would be show the correct page.
In my experimentation I've found that I can't get the presence "hidden" to affect anything. I used a messageBox to confirm that the presence status was set to "hidden" but the object in question stays visible, clickable, editable... etc. However, "invisible" does work as intended, but so far only for individual elements. I have not discovered how to hide a full page. Looping through an hiding all the elements isn't sufficient, since the page itself must be hidden.
This is the closest thing to working.
topmostSubform.Page1.textbox1.presence = "invisible";
xfa.host.messageBox("Presence: " + topmostSubform.Page1.textbox1.presence, "Debugging", 3);
I tried this for a page:
topmostSubform.Page2.presence = "invisible";
but nothing happened.
Is there a way to do what I want? What's wrong with "hidden"? Thanks all.
You should definitely set hidden for presence property of your page, because it makes object disappear and excludes from layout (doesn't reserve space for it) . When you set presence to invisible then object disappears but space is still reserved for it. More details you can find in: http://blogs.adobe.com/formfeed/2009/03/xfa_30_presenceinactive.html
It is hard to say without seeing your form why setting presence to hidden for field is not working for you. You may try to enable showing debugger console on errors to see whether any errors occurs. To do this go to Edit->Preferences->JavaScript in your Adobe Reader and select Show console on errors and messages