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 of rb.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 ID
  • getPageTheme() — Returns a string identifier for the currently set page theme
  • getLanguage() — Returns a string identifier for the currently set page language, for example, "en" for English.
  • getPageLocalization() — Returns the PageLocalization object for the page
  • getLocalizedMessage(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 the params argument.
  • getSection(sectionId) — Returns the Section object for the page section identified by sectionID, which is the original ID of the section
  • getFormDetails(formName) — Returns the FormContext object identified by the formName, where formName is one of:
    • rb.newui.util.EDIT_FORM_NAME — The form name for a record form
    • rb.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 the PageConstructionLog object
  • getCanvasEl() — 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 object
  • hasSessionExpired() — Returns true if the user session has expired, otherwise returns false.
  • 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 console
  • isPageDirty() — Returns true if the page has an object record form with modifications
  • isRedirectedOnServerValidation() — Returns true to identify when a user is redirected on submitting an object record form because it failed server-side validations
  • isDialogPage() — Returns true if 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();