Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Form Events Reference

[Applies to: Microsoft Dynamics CRM 2011]

All Client-Side code is initiated by events. In Microsoft Dynamics CRM you will associate a specific function within a JScript library to be executed when specific events occur.

All form events have a user interface you use to specify one or more event handers. Each event handler specifies a single function within a JScript library and any parameters that can be passed to the function.

OnLoad Event

The Onload event occurs after the form has loaded. It cannot prevent the window from loading. Use the OnLoad event to apply logic about how the form should be displayed, to set properties on fields, and interact with other page elements.

OnSave Event

The OnSave event occurs when a user presses certain buttons on the form. The event always occurs, even when the data in the form has not changed. To determine which button was clicked to perform the save, use the getSaveMode method.

You can cancel the save action by using the preventDefault method within the event arguments object, which is accessible by using the getEventArgs method that is part of the execution context. You must configure the form event handler to pass the execution context. For more information, see Use Execution Context and the Form Event Pipeline.

Field OnChange Event

The OnChange event usually occurs when the data in a form field has changed and focus is lost. Data in the field is validated before and after the OnChange event.

All fields support the OnChange event.

noteNote
There is an exception to this behavior after Microsoft Dynamics CRM 2011 Update Rollup 12 and Microsoft Dynamics CRM December 2012 Service Update. This exception applies to Two-Option (Boolean) fields that are formatted to use radio buttons or check boxes.

  • When Two-Option (Boolean) fields are formatted to use radio buttons, the OnChange event occurs immediately without requiring that the field lose focus.

  • When Two-Option (Boolean) fields are formatted to use check boxes, the OnChange event occurs immediately without requiring that the field lose focus except when the browser is Internet Explorer 7 or 8. In this case the control must lose focus before the OnChange event occurs.

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

noteNote
Although the Status field supports the OnChange 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.

Tab TabStateChange Event

The TabStateChange event occurs when the DisplayState of the tab changes due to user interaction or when the setDisplayState method is applied in code. Use this event when you wish to change the src property of an IFRAME within the tab.

noteNote
If you set the IFrame.src property in the OnLoad event for an IFRAME within a collapsed tab, the value will be overwritten when the tab is expanded.

IFRAME OnReadyStateComplete Event

The OnReadyStateComplete event indicates that the content of the IFRAME has loaded and can be accessed in code. Use this event when referencing IFRAME controls within your scripts.

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.