Attribute OnChange Event (Client API reference)

The OnChange event occurs in the following situations:

  • Data in a form field has changed and focus is lost. There is an exception to this behavior that applies to Two-Option (Boolean) fields that are formatted to use radio buttons or check boxes. In these cases the event occurs immediately.
  • Data changes on the server are retrieved to update a field when the form is refreshed, such as after a record is saved.
  • The attribute.fireOnchange method is used.

All fields support the OnChange event. Data in the field is validated before and after the OnChange event.

The OnChange event does not occur if the field is changed programmatically using the attribute.setValue method. If you want event handlers for the OnChange event to run after you set the value you must use the formContext.data.entity attribute.fireOnchange method in your code.

Note

Although the Status field supports theOnChange event, the field is read-only on the form so the event cannot occur through user interaction. Another script could cause this event to occur by using the fireOnchange method on the field.

Methods supported for this event

There are three methods you can use to work with the OnChange event for an attribute:

attributes (Client API reference)