Expand my Community achievements bar.

SOLVED

Changing Presence properties of an object on a Master Page

Avatar

Former Community Member

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 Accepted Solution

Avatar

Correct answer by
Former Community Member

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

View solution in original post

7 Replies

Avatar

Former Community Member

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

Avatar

Former Community Member

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

Avatar

Former Community Member

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";

}

Avatar

Former Community Member

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

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

CL

Avatar

Former Community Member

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?

Avatar

Correct answer by
Former Community Member

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

Avatar

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----