Chapter 4. Rules and Events

In this chapter, we will cover the following topics:

  • Form load event usage
  • Form save event usage
  • Field change event usage
  • Working with tabs and sections
  • Combining events
  • Enforcing business rules

Introduction

Handling specific events is something everybody expects from an application. While JavaScript has its own event handling model, working with Dynamics CRM offers a different set of events that we can take advantage of.

Note

The JavaScript event model, while it might work, is not supported, and definitely not the approach you want to take when working within the context of Dynamics CRM.

Some of the most notable events and their counterparts in JavaScript are described in the following table:

Dynamics CRM 2011

JavaScript

Description

OnLoad

onload

This is a form event. Executes when a form is loaded. Most common use is to filter and hide elements on the form.

OnSave

onsubmit

This is a form event. It executes when a form is saved. Most common use is to stop an operation from executing, as a result of a failed validation procedure.

TabStateChange

n/a

This is a form event. It executes when the DisplayState of the tab changes.

OnChange

onchange

This is a field specific event. It executes when tabbing out of a field where you've changed the value. Please note that there is no equivalent for onfocus and onblur.

OnReadyStateComplete

n/a

This event indicates that the content of an IFrame has completed loading.

Additional details on Dynamics CRM 2011 specific events can be found on MSDN at

http://msdn.microsoft.com/en-us/library/gg334481.aspx.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.219.33