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

SOLVED

Using a button to make a sub form visible and hidden

donn44157260
Level 5
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
donn44157260
Correct answer by
Level 5
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";

}

View solution in original post

2 Replies
donn44157260
Correct answer by
Level 5
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";

}

View solution in original post

Niall_O_Donovan
Level 10
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