Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Accessing objects on one master page, to change all examples of that master page

Avatar

Level 1

Hi,

I am currently developing a form, where my master page contains 5 logos on top of each other.

This is the setup in the hierarchy.

In "DATA::ready:form - (JavaScript, client)"

I run this code:

// Client spesific logo setup

xfa.resolveNode("form..IM_CUST_LOGO_1").presence = "hidden";                                       

xfa.resolveNode("form..IM_CUST_LOGO_2").presence = "hidden";                                       

xfa.resolveNode("form..IM_CUST_LOGO_3").presence = "hidden";                                         

xfa.resolveNode("form..IM_CUST_LOGO_4").presence = "hidden";                                          

xfa.resolveNode("form..IM_CUST_LOGO_OTHER").presence = "hidden";

The same after, just visible when different conditions are met.

My issue!

This works in the PDF, but just on the first page.

What i thaught worked

xfa.resolveNode("form1.#pageSet[0].Page1.IM_CUST_LOGO_1").presence = "hidden";

It did not

With maybe a loop, to go thru the pageSet[0] (if it worked).

Any help, please?

2 Replies

Avatar

Level 10

Hi,

What I have done in the past is have the five logos in image obects on the Master page, that are hidden. The have a blank imageField on the master page, with the following script in the docReady event:

// Set the imagefield object to read only

this.access = "readOnly";

Then sets the imageField data binding to Global in Object > Binding palette.

Lastly if you have a look at this example you will see how you can set the rawValue of the imageField to be the same as any of the image objects: http://assure.ly/mcFrC6.

Hope that helps,

Niall

Avatar

Level 1

Thank you Niall, that gave me the right direction. Although the site you linked to was down\gone.

So to give an update:

I got the images to be set to all pages, hooray!

But...

The image gets reset (?!) when i use things like dropdowns and checkboxes (when i exit them).

And no, there are absolutly no code that point to the pagesets or the images what so ever.

I am confused, why does the image go away?

Anyone?