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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Using a button to make a sub form visible and hidden

Avatar

Level 5

Good day all;

I am trying to figure out how to use a button instead of a checkbox to make a sub-form visible and when clicked again the sub-form will be hidden.

I have tried using an “if” statement but I do not seem to be able to get the logic right.

Any help would be appreciated.

The Chomp

1 Accepted Solution

Avatar

Correct answer by
Level 5

Got it working......

This is what I did. If there is a better way of doing this, please let me know.

if (approval_note_subform.presence == "hidden") {

approval_note_subform.presence = "visible";

}

else if (approval_note_subform.presence == "visible") {

    approval_note_subform.presence = "hidden";

}

2 Replies

Avatar

Correct answer by
Level 5

Got it working......

This is what I did. If there is a better way of doing this, please let me know.

if (approval_note_subform.presence == "hidden") {

approval_note_subform.presence = "visible";

}

else if (approval_note_subform.presence == "visible") {

    approval_note_subform.presence = "hidden";

}

Avatar

Level 10

Hi,

Perfect way to do it. Only small suggestion would be that because the subform can only be visible OR hidden, you can drop the else if part:

if (approval_note_subform.presence == "hidden") {

          approval_note_subform.presence = "visible";

}

else {

          approval_note_subform.presence = "hidden";

}

Good luck,

Niall