7 Replies Latest reply on Sep 28, 2010 12:30 PM by Chris Link, CTS

    Changing Presence properties of an object on a Master Page

    Chris Link, CTS

      Hi....

       

      Question:  When I change presence of a subform that resides on (Master Pages) Page1 from hidden (default setting) to visible, I only see it on the first page of the form.

       

      ORT_Form.resolveNode("#pageSet[0]").Page1.SubLock.presence = "visible";

       

      I set the subform to visible in the subform tab and then used the code above (changed to hidden) in the subforms initialization event.  This time, page 1 was hidden and the rest were visible.

       

      I presumed that any settings of the subform would be global across all the form pages by being on the master page.  This isnt working out as I expected.

       

      To test further...I placed a button next to the subform with the image on the Master Page, with the same code above.  I set the subform to hidden and then when I tested, I could make the image visible by clicking on the button on each page.

       

      So, how do I click ONE button and get this image to toggle presence on ALL pages?

       

      Any suggestions would be greatly appriciated.  This is not a big deal and if fluff at the end of the day.  I just want to understand it.

       

      Thank you

       

      Chris L

        • 1. Re: Changing Presence properties of an object on a Master Page
          pguerett Level 6

          The subform's somExpression is changing with each page. The Page1 node is carrying an occurance number. You can proove this by adding a command to your button (assuming it is on the Master Page) app.alert(this.somExpression). This command will display the som expression of the button when you press it. You will see that the Page1 node has an occurance number. So you will have to create a for loop and get the number of pages then loop theorugh each page and hide the subform object that you want.

           

          Paul

          1 person found this helpful
          • 2. Re: Changing Presence properties of an object on a Master Page
            Chris Link, CTS Level 1

            Hi Paul...

             

            Ok, so I see that Page1 has an instance of 0 - 4 for the 5 pages.  I get the For Loop, which I presume needs a varible for the page instance.  Since the number of pages is known (5), I presume I dont need the loop to figure out the number of pages, but incremental the page instance with the known values, started at 0 and +1 until = var=4.

             

            I am stuck on the correct syntax in Java. How to handle the Page1[x] instance.  I was able to get this to work in FormCalc easily.

             

            //Loop through all Page1 instance and toggle SubLock (FormCalc)

             

            var i;

            for i=0 upto (4) do

                 Page1(i).SubLock.presence="visible";

            endfor

             

            My attempt at making this a java scriptObject looks like this:

             

            //Function: LockStat - Toggle SubLock Visible

             

            function LockStat()

            {

            var i;

                 for (i=0;i<=5;i++)

                 {

                      Page1[i].SubLock.presence="visible";

                 }

            }

             

             

            After several attempt to resolve Page1[i] (including resolveNode for Page1) I am out of ideas.  So what am I missing here in Java-land that addresses this page instance?

             

            Thanks

            • 3. Re: Changing Presence properties of an object on a Master Page
              pguerett Level 6

              Couple of things ......you will need the page count to control the for loop. Remember that the page count is 1 based and the instances are 0 based. The sqaure brackets are an indication of an array in javasacript so you cannot use them the way you are. You can use the xfa.resolveNode("string that represents the object") notation. So your loop woudl look something like this:

               

               

              for (i=0;i<xfa.layout.pageCount();i++){

                    xfa.resolveNode("Page1[" + i + "]").SubLock.presence="visible";

              }

              1 person found this helpful
              • 4. Re: Changing Presence properties of an object on a Master Page
                Chris Link, CTS Level 1

                You know....I was wondering if XFA wasnt were I needed to be....

                 

                Ok...let me try this....thanks!

                 

                CL

                • 5. Re: Changing Presence properties of an object on a Master Page
                  Chris Link, CTS Level 1

                  Ok....

                   

                  That works....

                   

                  what if the button is not on the Master Page?  Ultimately, I want this to fire on a clickEvent of the Completed button located on Page 5.

                   

                  The loop works if the button originates on the master page, but not when I put it on the clickEvent of the Completed button....

                   

                  ORT_Form.Page5Admin.Btn_Completed::click - (JavaScript, client)

                   

                  Is this is a matter of resolving #pageSet[0] for the SubLock location?

                   

                   

                  • 6. Re: Changing Presence properties of an object on a Master Page
                    pguerett Level 6

                    The button works on the Master Page because you are operating in the same context. You simply need to provide the full path to the object in teh xfa.resolveNode statement....like you had in your original design.

                     

                    xfa.resolveNode("form1.PageSet.pageName.objectName .......

                     

                    Paul

                    • 7. Re: Changing Presence properties of an object on a Master Page
                      Chris Link, CTS Level 1

                      That did it...had a little weirdness but I made a couple of changes and worked around the issue.

                       

                      Looks like we are solid.

                       

                      Thanks Paul!

                       

                      CL