Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Master Page ok button if then statement

Avatar

Level 4

Hello,

I'm trying to have a button on the Master Page do different things according to which part of the form the user is on.

if (xfa.host.currentPage = "1" ) {

do x;

}

else {do something y;

}

It doesn't seem to work. It always does x.  I suspect that since it's really 1 long page (flowed subforms) it's treating all instances as currentPage = "1". 

Can I reference the current subform instead of page?

Is this even possible or do I need multiple Master Pages?

Also, I've been looking at the xfa.layout DOM examples online.  That's not in my version of LiveCycle as an option.  Very strange....

1 Accepted Solution

Avatar

Correct answer by
Level 4

Ok , it was just a dumb error.  When I tested it setting presence, I found out that the next  ok button was responding.  Meaning that I should have remembered that currentpages start off with 0, not 1.

Correct syntax:

if (xfa.host.currentPage =="0" ) {

this.presence = "invisible";

}

else {this.presence = "visible";

}

View solution in original post

3 Replies

Avatar

Level 10

I see a syntax error in your code..

It is supposed to be double equal sign.

    

if (xfa.host.currentPage == "1" ) {

Thanks

Srini

Avatar

Level 4

I made the change Srini,  but that currentPage script still doesn't work.

Here's the syntax now (just for testing):

<Ok button Click event>

if (xfa.host.currentPage =="1" ) {

this.presence = "invisible";

}

else {this.presence = "visible";

}

Avatar

Correct answer by
Level 4

Ok , it was just a dumb error.  When I tested it setting presence, I found out that the next  ok button was responding.  Meaning that I should have remembered that currentpages start off with 0, not 1.

Correct syntax:

if (xfa.host.currentPage =="0" ) {

this.presence = "invisible";

}

else {this.presence = "visible";

}