These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

control of an element placed on a masterpage

watson23
Registered: Mar 25 2008
Posts: 37

Hi,
I'd like to know whether there is any way to control e.g. the visibility of an element (such as a button or a text field) placed on a masterpage by clicking a button that is placed on a normal page (the one you can see in the design view)? How should I refer (from a normal page) to the elements placed on the masterpages? xfa.form.data.MasterPage1... doesn't seem to work the way that I'd like it to.
Any help will be greatly appreciated
Regards
T.M.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The master pages aren't really meant to have active content on them. It's supposed to be more of a static background.

But this doesn't mean that it can't be done. In LiveCycle Designer, display your master page. Select the field you are interested, or add the field to the master page. Then open up the Scripting window and select an event. The SOM path for the element will appear at the top of the script.

This is the path you need to use to access the element. Notice that it's down the "data" path in the "form" model. The funky looking "#pageSet[0]" name is the MasterPages node. On the hierarch window, select "Master Pages". Right click and select rename. To rename MasterPages to something else. As soon as you do this you'll see the name change in the elements SOM Path. Now you have a SOM path that can be used in JavaScript.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

watson23
Registered: Mar 25 2008
Posts: 37
I must admit that it actually looks obvious, however it still doesn't work... Maybe I do something wrong. Just for the case - here's the line I want to execute upon a button click (button placed on a normal page):
xfa.form.data.MPs.MasterPage2.MPButton.presence = "hidden";
I changed the (MasterPages) node name to MPs. Maybe this MPButton must be contained in a SubForm (or it can be placed directly on a master page)?
Regards
T.M.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I gave this a try and it worked for me, for a button directly on the master page. Did you save the form as Dynamic?

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

watson23
Registered: Mar 25 2008
Posts: 37
Yes, the form is saved as dynamic.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If the SOM Path is correct and the form is dynamic, then it should work. Have you checked the JavaScript console for errors?

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

watson23
Registered: Mar 25 2008
Posts: 37
Quite frankly, I have never used the JavaScript console so I'm not even sure how to use it...
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi watson23,

An article on using the JavaScript Console can be found at-

http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/javascript_console/

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com