show/hide subform by select radiobutton

Avatar

Avatar

eugzl

Avatar

eugzl

eugzl

06-11-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

06-11-2018

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

Answers (1)

Answers (1)

Avatar

Avatar

eugzl

Avatar

eugzl

eugzl

07-11-2018

Hi BR001. Thanks for replay.

Thanks for suggestion. Now CASE statement is working.