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
SOLVED

Make a page visible based on DDL

Avatar

Level 7

Hello,

I have a script in the exit event of a DDL, where if the rawValue == '8', then page8 should appear after the current page. The form is set to dynamic, the page is set to Hidden, Pagination on page8 is set to Following Previous. Here is the script:

 

if (this.rawValue == '4')
{
when.presence = "visible";
}

else if (this.rawValue != '4')
{
when.presence = "hidden";
}

else if (this.rawValue == '8')
{
  xfa.resolveNode("form1.page8").presence = "visible";
}

else
{
xfa.resolveNode("form1.page8").presence = "hidden";
}

myScriptObject.ShowForms(page4);

All the other lines in the script are working.

Thanks in advance for your help,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

I think you just need to re-write your if statement a bit.

The line: else if (this.rawValue != '4') is stopping the rest of the if statement from running.

You need to combine what you want to happen for each state. I think this is getting to where you want to be:

if (this.rawValue == '4') {

          when.presence = "visible";

          xfa.resolveNode("form1.page8").presence = "hidden";

}

else if (this.rawValue == '8') {

          when.presence = "hidden";

          xfa.resolveNode("form1.page8").presence = "visible";

}

else {

          when.presence = "hidden";

          xfa.resolveNode("form1.page8").presence = "hidden";

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

I think you just need to re-write your if statement a bit.

The line: else if (this.rawValue != '4') is stopping the rest of the if statement from running.

You need to combine what you want to happen for each state. I think this is getting to where you want to be:

if (this.rawValue == '4') {

          when.presence = "visible";

          xfa.resolveNode("form1.page8").presence = "hidden";

}

else if (this.rawValue == '8') {

          when.presence = "hidden";

          xfa.resolveNode("form1.page8").presence = "visible";

}

else {

          when.presence = "hidden";

          xfa.resolveNode("form1.page8").presence = "hidden";

}

Avatar

Level 7

That worked. Thank you.

Margaret Dawn