Expand my Community achievements bar.

Hide / show a master page field, on specific pages accessing by the pagename

Avatar

Former Community Member

Hi,

i have a field in the masterpage that i need to hide on some particular pages of a pdf form.

the scope is to hide the field called "phone" in an empty pages named "BlankPage"

this is my PDF structure:

- form1

     - (Master Pages)

          - MASTER (with the field that i need nto hide: "phone")

     - Page1

     - BlankPage1

     - Page2

     - BlankPage2

     - ...

in the MSF1701.#pageSet[0].MASTER::ready:layout i put something like this but i was unable to make it works:

if (xfa.layout.subform.name == "BlankPage") {

      xfa.resolveNode("phone").presence = "invisible";

}

else {

      xfa.resolveNode("phone").presence = "visible";

}

.. i need this kind of solution, please don't tell me to copy "phone" field on every page and calculate the value from the master page

thanks

1 Reply

Avatar

Level 10

Hi,

Why not place it on Page1 and Page2. You can set the binding of the phone object to Global, so that when any instance of phone has a value, it will automatically be displayed in all instances of phone. No script required.

Also using the layout:ready event will have a hit on performance, as this event fires EVERYTIME an object changes anywhere on the form. I don't think you will be able to get the page name that the page that is displayed (as the object is on the Master Page); however you can get the instance number of the Master Page. So if you really want to go for script on the Master Page then this in the layout:ready event of the phone object should work:

if (this.parent.index == 0 || this.parent.index == 2) {

     this.presence = "visible";

}

else {

     this.presence = "invisible";

}

As I say, I would not use the script solution.

Hope that helps,

Niall