Note: This works best if you think of your page as one long, single column, with fields grouped all the way horizontally across the screen. If you have multiple "columns" of content across the screen, PeopleTools may not be able to adjust the layout appropriately.
For our example, let's suppose that you have a page with a group box containing employee info fields, as well as a button that you'd like to use to show or hide the fields. Also, when the group box is hidden, we want the layout to automatically adjust itself to fill in the white space where the group box used to be.
My Info Group Box Expanded
My Info Group Box Hidden and Layout Adjusted
Set Page Properties
- Right-click on the Page and choose "Page Properties".
- On the "Use" tab, check the box for "Adjust Layout for Hidden Fields".
Set Group Box Properties
- Right-click on the Group Box and choose "Page Field Properties".
- On the "Record" tab, ensure that the Group Box has a Record and Field name associated with it. It is usually best to associate it with a Work Record:
- On the "Label" tab, check the box for "Adjust Layout for Hidden Fields".
- On the "Use" tab, check the box for "Hide all Fields when Group Box Hidden".
Add "Show/Hide" Button PeopleCode
- Right-click on your button and choose "View Record PeopleCode".
- Choose the "FieldEdit" event and add the following PeopleCode:
If MY_WORK_RECORD.GROUP_BOX_1.Visible = True Then
MY_WORK_RECORD.GROUP_BOX_1.Visible = False;
Else
MY_WORK_RECORD.GROUP_BOX_1.Visible = True;
End-If;
Automatically Hide on Page Load
If you'd like for the group box to default to being hidden when the page first loads, you can add Page Activate PeopleCode to accomplish this.- Right-click on the Page and choose "View Page PeopleCode".
- You will default to the "Activate" event. Add the following PeopleCode:
MY_WORK_RECORD.GROUP_BOX_1.Visible = False;