-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHide a Section of a Form.js
More file actions
26 lines (22 loc) · 1.11 KB
/
Hide a Section of a Form.js
File metadata and controls
26 lines (22 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This only shows a section on a form if the created on date is not blank.
function hideNotesOnNewProject(executionContext) {
var formContext = executionContext.getFormContext();
var createdOnValue = formContext.getAttribute("createdon").getValue(); // replace created on with a value your wanting to monitor for changes.
var isVisible = createdOnValue !== null;
setSectionVisibility(formContext, "SECTION_NOTES", isVisible); // replace with the logical name of the section from the form you are wanting to hide
}
function setSectionVisibility(formContext, sectionName, isVisible) {
var tabObj = formContext.ui.tabs.get("OVERVIEW_TAB"); // replace with the name of the form tab that your section to hide live on.
if (tabObj) {
var sectionObj = tabObj.sections.get(sectionName);
if (sectionObj) {
sectionObj.setVisible(isVisible);
}
}
}
// Register the event handler
function onFormLoad(executionContext) {
var formContext = executionContext.getFormContext();
// Check SECTION_NOTES visibility on form load
hideNotesOnNewProject(executionContext);
}