FieldContext

Purpose

For any field in an object record form on a new, edit, status change, or quick create page, a FieldContext object encapsulates state and behavior details for the associated field. The FieldContext object is only available in the New UI. You can access a FieldContext object using the client-side function rbf_getFieldContext().

Note:

The methods in this section apply to the new UI, not the classic UI. Most Platform tenants are using the new UI. However, tenants on older Private Cloud installations might still be using the classic UI.

These methods are not supported in portals.

Interface

The following functions return information about the state of the field:

  • getNode() — Returns a jQuery object for the HTML control (input, select, textarea, etc.)
  • getKendoConfig() — Returns the Kendo configuration object for the field (if the field is a Kendo control). Infinite Blue recommends using this function to access the Kendo configuration object for a field. It is faster and easier than using other methods, and it uses wrappers provided by Platform instead of working directly with the page DOM.
  • getFieldType() — Returns a string identifier for the field type, for example,'IntInput' for Integer fields
  • getFormNode() — Returns a jQuery node reference for the form element in t\he page DOM
  • getContainer() — Returns a jQuery object for the root container element that holds the field control and its related DOM elements

The following functions return information about and allow you to specify the field's behavior:

  • validate() — Runs client-side validation against the field
  • enable(isEnabled) — Toggles whether the field is enabled or disabled.
  • show() — Shows the field
  • hide() — Hides the field
  • focus() — Gives focus to the field
  • isRequiredField() — Returns true if the field is marked as a required form field, otherwise returns false.
  • getValue() — Returns the field's current value
  • setValue(value) — Sets the field's value to value
  • addOnChangeHandler(handlerFunc) — Adds the change handler function handlerFunc to the field
  • getInitialValue() — Returns the initial value of the form field when the form page was rendered
  • hasValueChanged() — Returns true if the field value was modified on the form page
  • getPicklistCode() — Returns the integration code of the selected option for a picklist, multi-picklist, checkbox group, or radio buttons. When multiple options are selected, returns an array of integration codes.