Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Hide Object on Page > 1

dpz_
Level 2
Level 2

Hi,

i want to hide an Object with

object.presence = "hidden";

only when its not on the first page. How can i manage this?

In Event initialize xfa.layout.page(this) is not available.

In Event layout:ready its too late to hide the Object.

Is there a fitting Event for my need?

Regards

dpz

5 Replies
_Bruce_Robertson
Level 10
Level 10

Hi,

I think layout:ready is the one you want, setting the presence in this event will cause it to fire again, is that the problem do you get some flickering?

Bruce

dpz_
Level 2
Level 2

I tried this:

data.MAIN.Tabelle1.Kopfzeile_First.Kopf_Main.Kopf_Main_1::ready:layout - (JavaScript, client)

page = xfa.layout.page(this);

if (page == 1 ) {

xfa.host.messageBox("First " + page.toString());

}

else {

xfa.host.messageBox("Hide " + page.toString());

data.MAIN.Tabelle1.Kopfzeile_First.Kopf_Main.Kopf_Main_1.presence = "hidden";

}

Result with 3 Pages is:

First Page: Instead of Kopf_Main_1 there is an empty space (as i would expect using invisible)

Page 2 & 3: Kopf_Main_1 is shown.

I can see 3 Popups 1,2,3 as expected.

Kopf_Main_1 is a Table.

Whats wrong here?

Regards

Daniel

_Bruce_Robertson
Level 10
Level 10

Hi Daniel,

I think the line "data.MAIN.Tabelle1.Kopfzeile_First.Kopf_Main.Kopf_Main_1.presence = "hidden";" needs to be something like "this.presence = "hidden";" .  The this object will be set to the target of the event, and the specific occurrence of the target, you have a absolute reference which will always resolve to the first occurrence.

Regards

Bruce

dpz_
Level 2
Level 2

Hi Bruce,

you are right, this.presence works better but i reached still not the wanted result.

Now i get

1st Page. Correct. Obejct in shown

2nd and 3rd Page: Object is not shown but there is a white space instead of the object. I would expect this when using "invisible".

Perhaps this is because the form is already rendered and so i get white gaps when hiding elements?

Regards

Daniel

_Bruce_Robertson
Level 10
Level 10

Hi Daniel,

It's hard to know without looking at your form, is the object you are setting as hidden in a table?

If you can upload your form to google docs, dropbox, or similar and post a link to your form, I'm happy to have a look.

Bruce