แก้ไข

แชร์ผ่าน


Controls (Client API reference)

A control represents an HTML element present on the form. Some controls are bound to a specific column, whereas others may represent unbound controls such as an IFRAME, web resource, or a subgrid that has been added to the form.

The control object provides methods to change the presentation or behavior of a control and identify the corresponding column. You access controls using one of the following collections:

  • formContext.ui.controls
  • formContext.ui Section.controls
  • formContext.data.entity Attribute.controls

The formContext.getControl method is a shortcut method to access formContext.ui.controls.get.

Controls are categorized by type. You can determine the type of a control by using the getControlType method. Certain control methods are only available for specific types of controls.

This article provides information about the methods available per control type.

standard control type

These are the methods available for a Standard control.

The following methods for the Standard control are deprecated in this release: addOnKeyPress, fireOnKeyPress, and removeOnKeyPress.

iframe control type

These are the methods available for an IFRAME control.

kbsearch (Knowledge base search) control type

These are the methods available for knowledge base search control.

Note

When the knowledge base search control is added to the social pane, the name of the control will be "searchwidgetcontrol_notescontrol". This name can't be changed.

lookup control type

These are the methods available for a lookup control.

choices and choice control types

Both choices and choice controls have the same set of methods available.

quickform control type

See formContext.ui.quickForms for information about methods supported for this control type.

subgrid control type

See Grids and subgrids for information methods supported for this control type.

timelinewall control type

The timeline control presents the Posts, Activities, and Notes in a unified view. These are the methods available for this control type.

timer control type

These are the methods available for the timer control.

web resource control type

A web resource control has the same set of methods available as the iframe control. See iframe control type

The Sliverlight web resource has these additional methods:

Tip

If you want to modify all the controls bound to a column on a form, use the controls collection inside the column type. For example, to add notification to each control bound to the name column, you can do the following:

 const notification = { messages: ['Sample Notification on Name Controls'], notificationLevel: 'RECOMMENDATION', uniqueId: 'my_unique_id'};
formContext.getAttribute("name").controls.forEach(control => control.addNotification(notification));

Form component control type

A form component control type has the same set of methods available as the formContext on a main form. See Form component behavior > Client API

Columns