Form Event: OnLoad
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, such as IFrames.
Example
The following code example displays the entity type code:
alert("This is the type code: " + crmForm.ObjectTypeCode);
Example
The following code example displays the ID of the entity in an update form.
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
switch (crmForm.FormType)
{
case CRM_FORM_TYPE_CREATE:
alert("This is a create form.");
break;
case CRM_FORM_TYPE_UPDATE:
alert("This is an update form, the ID is " + crmForm.ObjectId);
break;
}
See Also
Concepts
Reference
Other Resources
© 2009 Microsoft Corporation. All rights reserved.