Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Is there code to hide/show multiple pages?

Avatar

Former Community Member

I'm very much a novice at Livecycle and coding but I have a project that is very page heavy. I'm working in LC ES2.

I'm up to over 50 pages now and my task is to dynamically hide/show only pages necessary to open certain account types based on user selection of a dropdown list.

I'm stuck on how to do so in the most efficient manner. I've been working mostly with the action builder so far and I have messed around with a very short piece of scipt to make the presence hidden for various pages on the initialize event, then an action builder to show specific pages driven by the selection of text in the dropdown.

My question begins with, Is there some sort of script that I can add to make every page except page 1 hidden by default, then have my action builders show  whichever pages I need?

Has anyone done anything similar and have any suggestions or samples of how you resolved the task?

Thanks!

4 Replies

Avatar

Level 7

Something like this or a similar switch statement:

if (this.rawValue == 1) {

          p2.presence = "visible";

          p3.presence = "hidden";

}

else {

          p3.presence = "visible";

          p2.presence = "hidden";

}

Avatar

Level 2

I need to know if you got an answer for your question?  I have a similar situation:

I have a form with many pages.  I want page (1) active and visible.  I want all other pages invisible unless the corresponding sn field on page (1) is filled in.

Example

Page 1

sn for page 2 entries

sn for page 3 entries

sn for page 4 entries

etc

page 2, page 3, page 4, etc should be visible only if something is entered in the sn field of page (1).  Like, "If sn for page 2 = null than page 2 "hidden".

Can this be done?

Sorry, new to livecycle

Thanks!

Avatar

Former Community Member

Good Morning,

My situation was a little different in that I needed to show/hide various pages based on a couple different levels. Basically I used the sugessted sample that jasotastic81 provided.

I have about 15 pages that are account openning checklists that I decided to set the presence to hidden in the initialize event.

In the change event, these become shown/hidden based on the user selection of a dropdown list.

Sample:

if ($.boundItem(xfa.event.newText) == "79 - Participant Ac Unitized Accounting" || $.boundItem(xfa.event.newText) == "79 - Pooled Income Sub Accounts") {

  this.resolveNode("SubAccts").presence = "visible";

}

else {

  this.resolveNode("SubAccts").presence = "hidden";

  xfa.layout.relayout();

}

Then when the user selects the various additional documents required to open that particiular account type in the checklist, other pages become shown or hidden using similar code in the click event of the checboxes.

sample:

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

  AcctDisclosure.presence = "visible";

}

else {

  AcctDisclosure.presence = "hidden";

  xfa.layout.relayout();

}

Hope this helps.

Avatar

Level 2

On the exit event of your sn2 field:

Page2.presence = ( sn2.rawValue == "" ? "hidden" : "visible")