I have a dynamic form with flowing tables. Based on user input on page 1 (Master Page 1), we want subsequent pages (based on Master Page 2) to have 1 of 5 different logos (image fields) on the top right hand corner.
I have scripted a field on page 1 to change the visibility of the 5 image fields on Master Page 2, depending on the choice of the user. The difficulty is that while this works on the first instance of Page 2, as the user adds rows to the table and it flows onto the next page, the logo disappears.
Reading through forums, it appears that putting dynamic content (such as changing the visibility of the image fields) on Master Pages can cause difficulties.
A solution I am trying to get to work involves having 5 separate Master Pages. Each one has the static image field. Then what I am trying to do is get Page 2 to use the appropriate Master Page depending on the choice of the user.
I have tried to get conditional breaks in the pagination tab to force a different Master Page, but cannot get this to work at all.
Solved the problem and I am posting the workaround...
I gave up on trying to call the master pages and went back to JP Terry's book.
He provided the script for changing images:
imageField1.rawValue = image1.value.image.value;
This worked a treat, as I moved the five static images to a body page and made them invisible. Then I put an image field in the master pages. A simple script based on JP Terry's example pushed the applicable logo into the image field on the master pages. Worked first time - I would strongly recommend his book as it is packed full of great tips and tricks!!!
Could you post details on your script? I am trying to do something similar, and this sounds like it could really help.
For clarity, I just kept the form with 2 Master Pages. The logos are on Master_Page2.
Start off by adding an Image Field (logo) to Master_Page2. Set the presence to visible and the legend to none. Do not give this Image Field a URL
Then on page 1 of the form insert five Static Image objects. Set the URL for each of these static objects with your five logos. Remember to embed the image data. Then set the presence to invisible.
var oSubform = xfa.resolveNode("xfa.form.form1.#pageSet.Master_Page2.logo"); //This references the Image Field on the Master Page