Expand my Community achievements bar.

SOLVED

Make specific section visible via Checkbox-Button?

Avatar

Level 1

Hello there

is it possible to make a specific section of a form only visible if a checkbox is checked? I think it might be possible via AddItem script? For example, I want the section "Materials Managements" to be only visible if the Checkbox "Materials Managements" is also checked. I attached my PDF, can anyone help?

Kind regards

MrWilson

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can include an if statement in the click event of the checkbox. This will look at the value of the checkfield (1 = on; 2 = off). Then depending on the value it will make the associated subform either visible or hidden (excluded from the layout). I have wrapped each section in its own subform (positioned) which makes it easier to reference.

if (this.rawValue == 1)

{

     flowedSubform.materialsManagement.presence = "visible";

}

else

{

     flowedSubform.materialsManagement.presence = "hidden";

}

Taking this further, you can wrap all three subforms in a flowed subform and save the file as dynamic. This way if a subform is hidden, the remaining subforms will take up the space.

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

You can include an if statement in the click event of the checkbox. This will look at the value of the checkfield (1 = on; 2 = off). Then depending on the value it will make the associated subform either visible or hidden (excluded from the layout). I have wrapped each section in its own subform (positioned) which makes it easier to reference.

if (this.rawValue == 1)

{

     flowedSubform.materialsManagement.presence = "visible";

}

else

{

     flowedSubform.materialsManagement.presence = "hidden";

}

Taking this further, you can wrap all three subforms in a flowed subform and save the file as dynamic. This way if a subform is hidden, the remaining subforms will take up the space.

Hope that helps,

Niall

Avatar

Level 1

Thank you very much, that was exactly what I was looking for!

Kind regards

MrWilson