cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically hide Master Page in ADOBE Form

08-17-2021 8:50 AM
cpz Explorer
9818 views 8 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi All,

I am attempting to dynamically hide a Master Page when outputting an ADOBE Form, but page contents is blanked out and a blank page is still outputted. This is what I have in my SFP Form:

Variable GV_HAS_TEXT when = null, I want to hide ThirdPage.

Below is the Form Calc Script I have for ThirdPage in Events: Initialization, Form Ready and Layout Ready:

if ( $.GV_HAS_TEXT == null ) then

$.presence = "hidden"

endif

When the above script condition is met, the Subform contents are all hidden, but a blank page is still outputted at the end of the Form....which is what I don't want?

Would appreciate any assistance.

thanks,

Con.

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

cpz
Explorer
0 Likes

I have found a solution, which may help others with similar issue:

1. In the Hierarchy View, right click 'data' node (highest level in hierarchy), and click 'New Page', which will insert a Subform at the same level as the 'Page Set' node. You should now see a new page appear in the 'Design View' Tab for the Subform.

2. Design your output for this page under the new Subform created in previous step. Insert a variable (eg. GV_SHOW_PAGE), inside this Subform and hide it.

3. In the Form Interface, set variable GV_SHOW_PAGE based on logic which determines if there is content for another page to be output, eg. set GV_SHOW_PAGE = 'X', else clear GV_SHOW_PAGE if not.

4. At the Subform level in the Hierarchy View, in it's 'initialize' event add the following FormCalc code via the script editor:

if ( $.GV_SHOW_PAGE == null ) then

$.presence = "hidden"

endif

The above code will stop output of the page.

Con.

Answers (3)

Answers (3)

cpz
Explorer
0 Likes

This is the Master Page Hierarchy:

cpz
Explorer
0 Likes

Hi Pascal,

Thank you for responding.

re...'"ready:form" event'.....i assume you mean the 'form:ready' event?

I added the below under the 'data' statement, but page is still visible?

data.CreditMemo.ThirdPage.subform::ready:form - (JavaScript, client)

this.presence = "hidden";

Is this the correct place to put the code?

This is the Master Page Hierarchy:


re...'extending the Content Area, so the content has more "space" for pagination.'....i don't understand what you mean by this? Currently the Content Area (LongText in above hierarchy), is just slightly smaller than the page area.

thanks,

Con.

PascalBremer
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Con,
you cannot hide a master page. Also they contain the content area, so deleting them would yield you an entirely blank document.
What you probably want is hidden a specific page after pagination.
At first I would check if you can maybe fix this issue by extending the content area, so the content has more "space" for pagination.

If this does not work you can hide any page by specifying : this.presence = "hidden" but this scripting should ONLY be applied to the "ready:form" event.

Best regards
Pascal

0 Likes

Dear Pascal,

thanks so much for adding the information about the "ready:form" event. I found the scripting on so many sites but nobody ever mentioned the correct event.

Best regards

Henning

raul_daimiel
Participant
0 Likes

Dear pascal.bremer,

Has been a little while since we "chat" here!. 🙂

As usually, THANK YOU very much for your guidance here!. :).

I do have a similar topic: Based on some settings in a customizing table, an extra page with either Landscape or Portrait orientation is needed. If the page needs to be landscape printed, the portrait one will be hidden, and vice versa.

Two Master Pages ( see picture ) with the required number of content areas has been created.

For each of the Master Pages, a page to print the text in the correct orientation is defined.
These pages will have a Subform per each column. And will be Hidden From Layout as default.
The text is binded, flowed until filling the columns texts and displayed on the correct page accordingly 🙂

In order to get the scenarios above ready, the following scripting has been applied in JavaScript.

 data.BODY.V_ORIENTATION::initialize - (JavaScript, client)
 if ( this.rawValue == "L" )
 { 
 xfa.resolveNode("data.PORTRAIT").presence = "hidden";
 xfa.resolveNode("data.LANDSCAPE").presence = "visible";  
 }
 data.BODY.V_ORIENTATION::docReady - (JavaScript, client)
 if ( this.rawValue == "L" )
 { 
 xfa.resolveNode("data.PORTRAIT").presence = "hidden";
 xfa.resolveNode("data.LANDSCAPE").presence = "visible";  
 }
Unfortunately it does not work. The 'non valid' page appears anyway...

Should I place it on form:ready event?. Wll try and let you know!!.
Thank you very much in advance!!!Kind Regards.Raúl