PageContext
Purpose
A PageContext object encapsulates all state and behavior of a
page. This is the root level context object from which you can access other top
level objects such as PageLocalization. The
PageContext object is only available in the New UI. You can
access a PageContext object using the client-side function rbf_getPageContext().
Interface
The following functions return information about the state of the page or return components on the page:
getPageType()— Returns an integer identifier for the current page. All page identifiers are defined as properties ofrb.newui.PAGE_TYPES. This API can be leveraged to have custom behavior specific to a given page, for example, to differentiate between a new and edit page to set a default value for a field in new pages.Page types are defined as follows:
rb.newui.PAGE_TYPES = { GENERIC : 0, VIEW : 1, EDIT : 2, NEW : 3, SEARCH : 4, SEARCH_RESULTS : 5, STATUS : 6, SELECTOR : 7, EMAIL_SELECTOR : 8,// Used as substitution to TYPE_SELECTOR TREE_SELECTOR : 9, IMPORT : 10, TEMPLATES : 12, REP_LIST : 13, REPORT : 14, LOGIN : 16, MASS_UPDATE : 17, NEW_QUICK : 18, CUSTOM_PAGE : 19, WEB_LINK : 20, QUESTIONS : 21, LIST : 22,// List of records SURVEY : 23,// Take survey EMBED_QC : 24, R_BIN_VIEW : 25 };getPageId()— Returns the page IDgetPageTheme()— Returns a string identifier for the currently set page themegetLanguage()— Returns a string identifier for the currently set page language, for example, "en" for English.getPageLocalization()— Returns thePageLocalizationobject for the pagegetLocalizedMessage(langResKey,params)— Returns the externalized string label for the specified language resource key. If the externalized string is parameterized, it will replace all param tokens with values passed in theparamsargument.getSection(sectionId)— Returns theSectionobject for the page section identified bysectionID, which is the original ID of the sectiongetFormDetails(formName)— Returns theFormContextobject identified by theformName, whereformNameis one of:rb.newui.util.EDIT_FORM_NAME— The form name for a record formrb.newui.util.INLINE_FORM_NAME— The form name for an inline edit form
This is currently only available for record forms and inline edit forms.
getPageConstructionLog()— Returns thePageConstructionLogobjectgetCanvasEl()— Returns the jQuery object for the root canvas element that renders all the page content. Infinite Blue recommends using this method to run any jQuery selectors.getPageToolbar()— Returns the PageToolbar objecthasSessionExpired()— Returnstrueif the user session has expired, otherwise returnsfalse.getCurrentUITemplate()— Returns the CurrentUITemplate object.
The following functions return information about and allow you to specify the page's behavior:
printPageConstructionLog()— Prints the page construction log with timing details onto the consoleisPageDirty()— Returnstrueif the page has an object record form with modificationsisRedirectedOnServerValidation()— Returnstrueto identify when a user is redirected on submitting an object record form because it failed server-side validationsisDialogPage()— Returnstrueif the current page is rendered in a dialog, for example, a quick create page
The following class methods control whether Platform notifies the user upon navigating away from a page with unsaved changes. See onLeavingDirtyPage for information about the property that has the same effect.
addDirtyPageNotifier()— Enables notification when a user tries to navigate from a page with unsaved changes. Example:rb.newui.page.PageContext.addDirtyPageNotifier();removeDirtyPageNotifier()— Disables notification when a user tries to navigate from a page with unsaved changes. Example:rb.newui.page.PageContext.removeDirtyPageNotifier();