Hide Section
Overview
You can show or hide an entire form section using a Client Script and g_form.setSectionDisplay(). This is useful in situations like only showing a set of fields when a record is first being submitted (i.e. the record doesn’t exist yet), or toggling between two alternate sections based on a field’s value.
Finding the Section Name
The name setSectionDisplay() expects is auto-generated by the system, not the label shown on the form. To derive it from the label:
- Lowercase the entire label.
- Replace the first space with an underscore.
- Remove all remaining spaces.
- Remove any other non-alphanumeric characters (e.g.
&).
Example: Label "Section Four is Here" → Section name section_fourishere
Example
The following onLoad Client Script toggles between an Asset Lookup section and a Dispose Unlisted Asset section depending on whether the record is new and whether the u_unlisted_asset field is checked:
HideSection.js
| |
setSectionDisplay() only works for onLoad and onChange Client Scripts, and only on sections — it cannot show or hide individual fields (use g_form.setVisible() for that).Last updated on