Expand my Community achievements bar.

SOLVED

show/hide subform by select radiobutton

Avatar

Level 5

Hi All.

I try to show and show/hide some subforms by click on radiobutton. By default all subforms are hidden. When I click radiobutton the according sunform is appears. But when I selected other radiobutton the other subform is appears also but first subform not disappear. My goal to display only one subform for according radiobutton. That is my code for radiobutton group in change event:

switch (this.rawValue) {

case "1":

subA.presence = "visible";

break;

case "2":

subS.presence = "visible";

break;

case "3":

subP.presence = "visible";

break;

case "4":

subC.presence = "visible";

break;

case "5":

subO.presence = "visible";

break;

case "6":

subW.presence = "visible";

break;

    default:  

subA.presence = "hidden";

subS.presence = "hidden";

subP.presence = "hidden";

subC.presence = "hidden";

subO.presence = "hidden";

subW.presence = "hidden";

    break;

}

To keep subforms hidden when form is open I use that code:

subA.presence = "hidden";

subS.presence = "hidden";

subP.presence = "hidden";

subC.presence = "hidden";

subO.presence = "hidden";

subW.presence = "hidden";

In form1.Page1::docReady - (JavaScript, client).

I would appreciate any corrections/suggestions!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi

Try duplicating your docReady code before the case statement, the default branch is executed when no case branch is selected so in your case will be executed when the radiobutton value is not between 1 and 6

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi

Try duplicating your docReady code before the case statement, the default branch is executed when no case branch is selected so in your case will be executed when the radiobutton value is not between 1 and 6

Avatar

Level 5

Hi BR001. Thanks for replay.

Thanks for suggestion. Now CASE statement is working.