Expand my Community achievements bar.

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";

}

View solution in original post

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