Expand my Community achievements bar.

SOLVED

Click function on a button

Avatar

Level 3

Hi,

I'm trying to create a button that would make a subform invisible when clicked and visible once it's clicked again. I usually use radio buttons to accomplish this under the change function (see below) BUT this time I want to use a button.

Thank you very much for your help!!!!

if (this.rawValue == "1") {

InvoiceBilling.presence = "visible";

InternalBilling.presence = "hidden";

}

else {

InvoiceBilling.presence = "hidden";

InternalBilling.presence = "visible";

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Buttons don't have value, so the if statement will fail.

Instead test against the presence of one of the objects. For example JavaScript in the click event of the button:

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

     InvoiceBilling.presence = "visible";

     InternalBilling.presence = "hidden";

}

else {

     InvoiceBilling.presence = "hidden";

     InternalBilling.presence = "visible";

}

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

Buttons don't have value, so the if statement will fail.

Instead test against the presence of one of the objects. For example JavaScript in the click event of the button:

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

     InvoiceBilling.presence = "visible";

     InternalBilling.presence = "hidden";

}

else {

     InvoiceBilling.presence = "hidden";

     InternalBilling.presence = "visible";

}

Hope that helps,

Niall